Spaces:
Running
on
Zero
Running
on
Zero
handle categories better
Browse files
app.py
CHANGED
@@ -43,11 +43,12 @@ with gr.Blocks() as nps:
|
|
43 |
def add_category():
|
44 |
new_box = gr.Textbox(label="Category", placeholder="Enter a category")
|
45 |
category_boxes.append(new_box)
|
46 |
-
return
|
47 |
|
48 |
category_boxes = [] # Store category input boxes
|
|
|
49 |
add_category_btn = gr.Button("Add Category")
|
50 |
-
add_category_btn.click(fn=add_category, outputs=
|
51 |
uploaded_file = gr.File(label="Upload CSV", type="filepath")
|
52 |
template_btn = gr.Button("Use Template")
|
53 |
gr.Markdown("# NPS Comment Categorization")
|
@@ -74,6 +75,7 @@ with gr.Blocks() as nps:
|
|
74 |
|
75 |
uploaded_file.change(fn=load_data, inputs=uploaded_file, outputs=output)
|
76 |
template_btn.click(fn=lambda: "Using Template Dataset", outputs=output)
|
|
|
77 |
classify_btn.click(fn=classify_comments, inputs=category_boxes, outputs=output)
|
78 |
|
79 |
nps.launch()
|
|
|
43 |
def add_category():
|
44 |
new_box = gr.Textbox(label="Category", placeholder="Enter a category")
|
45 |
category_boxes.append(new_box)
|
46 |
+
return category_boxes
|
47 |
|
48 |
category_boxes = [] # Store category input boxes
|
49 |
+
category_column = gr.Column()
|
50 |
add_category_btn = gr.Button("Add Category")
|
51 |
+
add_category_btn.click(fn=add_category, outputs=category_column)
|
52 |
uploaded_file = gr.File(label="Upload CSV", type="filepath")
|
53 |
template_btn = gr.Button("Use Template")
|
54 |
gr.Markdown("# NPS Comment Categorization")
|
|
|
75 |
|
76 |
uploaded_file.change(fn=load_data, inputs=uploaded_file, outputs=output)
|
77 |
template_btn.click(fn=lambda: "Using Template Dataset", outputs=output)
|
78 |
+
template_btn.click(fn=lambda: [gr.Textbox.update(value="Product Experience"), gr.Textbox.update(value="Customer Support"), gr.Textbox.update(value="Price of Service"), gr.Textbox.update(value="Other")], outputs=category_column)
|
79 |
classify_btn.click(fn=classify_comments, inputs=category_boxes, outputs=output)
|
80 |
|
81 |
nps.launch()
|