Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,8 +71,28 @@ def use_template():
|
|
| 71 |
template_categories = ["Product Experience", "Customer Support", "Price of Service", "Other"]
|
| 72 |
return template_categories, f"**Categories:**\n" + "\n".join([f"- {cat}" for cat in template_categories])
|
| 73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
# Gradio Interface
|
| 75 |
-
with gr.Blocks() as nps:
|
| 76 |
# State to store categories
|
| 77 |
categories = gr.State([])
|
| 78 |
|
|
@@ -96,7 +116,7 @@ with gr.Blocks() as nps:
|
|
| 96 |
- Upload a CSV file with at least one column: `customer_comment`.
|
| 97 |
- If you don't have your own data, click **Use Template** to load a sample dataset.
|
| 98 |
""")
|
| 99 |
-
template_btn = gr.Button("β¨ Use Template", size="sm"
|
| 100 |
|
| 101 |
gr.Markdown("---")
|
| 102 |
|
|
@@ -106,8 +126,8 @@ with gr.Blocks() as nps:
|
|
| 106 |
# Category input and buttons
|
| 107 |
category_input = gr.Textbox(label="π New Category", placeholder="Enter category name", scale=1)
|
| 108 |
with gr.Row():
|
| 109 |
-
add_category_btn = gr.Button("β Add Category", size="sm"
|
| 110 |
-
reset_btn = gr.Button("π Reset Categories", size="sm"
|
| 111 |
# Category display
|
| 112 |
category_status = gr.Markdown("**π Categories:**\n- None")
|
| 113 |
with gr.Column(scale=1):
|
|
@@ -123,7 +143,7 @@ with gr.Blocks() as nps:
|
|
| 123 |
# Classify button and output
|
| 124 |
with gr.Row():
|
| 125 |
with gr.Column(scale=1):
|
| 126 |
-
classify_btn = gr.Button("π Classify", size="sm"
|
| 127 |
with gr.Column(scale=3): # Center the container and make it 75% of the window width
|
| 128 |
output = gr.HTML()
|
| 129 |
|
|
|
|
| 71 |
template_categories = ["Product Experience", "Customer Support", "Price of Service", "Other"]
|
| 72 |
return template_categories, f"**Categories:**\n" + "\n".join([f"- {cat}" for cat in template_categories])
|
| 73 |
|
| 74 |
+
# Custom CSS for button styling
|
| 75 |
+
custom_css = """
|
| 76 |
+
button {
|
| 77 |
+
background-color: #4c6bfd !important;
|
| 78 |
+
border: none !important;
|
| 79 |
+
color: white !important;
|
| 80 |
+
padding: 10px 20px !important;
|
| 81 |
+
text-align: center !important;
|
| 82 |
+
text-decoration: none !important;
|
| 83 |
+
display: inline-block !important;
|
| 84 |
+
font-size: 16px !important;
|
| 85 |
+
border-radius: 5px !important;
|
| 86 |
+
transition: background-color 0.3s ease !important;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
button:hover {
|
| 90 |
+
background-color: #3a52cc !important;
|
| 91 |
+
}
|
| 92 |
+
"""
|
| 93 |
+
|
| 94 |
# Gradio Interface
|
| 95 |
+
with gr.Blocks(css=custom_css) as nps:
|
| 96 |
# State to store categories
|
| 97 |
categories = gr.State([])
|
| 98 |
|
|
|
|
| 116 |
- Upload a CSV file with at least one column: `customer_comment`.
|
| 117 |
- If you don't have your own data, click **Use Template** to load a sample dataset.
|
| 118 |
""")
|
| 119 |
+
template_btn = gr.Button("β¨ Use Template", size="sm")
|
| 120 |
|
| 121 |
gr.Markdown("---")
|
| 122 |
|
|
|
|
| 126 |
# Category input and buttons
|
| 127 |
category_input = gr.Textbox(label="π New Category", placeholder="Enter category name", scale=1)
|
| 128 |
with gr.Row():
|
| 129 |
+
add_category_btn = gr.Button("β Add Category", size="sm")
|
| 130 |
+
reset_btn = gr.Button("π Reset Categories", size="sm")
|
| 131 |
# Category display
|
| 132 |
category_status = gr.Markdown("**π Categories:**\n- None")
|
| 133 |
with gr.Column(scale=1):
|
|
|
|
| 143 |
# Classify button and output
|
| 144 |
with gr.Row():
|
| 145 |
with gr.Column(scale=1):
|
| 146 |
+
classify_btn = gr.Button("π Classify", size="sm")
|
| 147 |
with gr.Column(scale=3): # Center the container and make it 75% of the window width
|
| 148 |
output = gr.HTML()
|
| 149 |
|