ZennyKenny commited on
Commit
c00c984
Β·
verified Β·
1 Parent(s): 67df231

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -46,7 +46,7 @@ with gr.Blocks() as nps:
46
  def add_category(categories, new_category):
47
  if new_category.strip() != "" and len(categories) < 5: # Limit to 5 categories
48
  categories.append(new_category.strip())
49
- return categories, f"Categories: {', '.join(categories)}"
50
 
51
  # Function to display categories
52
  def display_categories(categories):
@@ -56,7 +56,7 @@ with gr.Blocks() as nps:
56
  with gr.Row():
57
  category_input = gr.Textbox(label="New Category", placeholder="Enter category name")
58
  add_category_btn = gr.Button("Add Category")
59
- category_status = gr.Markdown("Categories: None")
60
 
61
  # Display added categories
62
  category_display = gr.Column(visible=False)
@@ -89,13 +89,13 @@ with gr.Blocks() as nps:
89
  # Function to use template categories
90
  def use_template():
91
  template_categories = ["Product Experience", "Customer Support", "Price of Service", "Other"]
92
- return template_categories, f"Categories: {', '.join(template_categories)}"
93
 
94
  # Event handlers
95
  add_category_btn.click(
96
  fn=add_category,
97
  inputs=[categories, category_input],
98
- outputs=[categories, category_status]
99
  )
100
  categories.change(
101
  fn=display_categories,
 
46
  def add_category(categories, new_category):
47
  if new_category.strip() != "" and len(categories) < 5: # Limit to 5 categories
48
  categories.append(new_category.strip())
49
+ return categories, "", f"**Categories:**\n" + "\n".join([f"- {cat}" for cat in categories])
50
 
51
  # Function to display categories
52
  def display_categories(categories):
 
56
  with gr.Row():
57
  category_input = gr.Textbox(label="New Category", placeholder="Enter category name")
58
  add_category_btn = gr.Button("Add Category")
59
+ category_status = gr.Markdown("**Categories:**\n- None")
60
 
61
  # Display added categories
62
  category_display = gr.Column(visible=False)
 
89
  # Function to use template categories
90
  def use_template():
91
  template_categories = ["Product Experience", "Customer Support", "Price of Service", "Other"]
92
+ return template_categories, f"**Categories:**\n" + "\n".join([f"- {cat}" for cat in template_categories])
93
 
94
  # Event handlers
95
  add_category_btn.click(
96
  fn=add_category,
97
  inputs=[categories, category_input],
98
+ outputs=[categories, category_input, category_status]
99
  )
100
  categories.change(
101
  fn=display_categories,