Update app.py
Browse filesChanging layout of the components in both tabs. Changing variable names and adding additional comments for clarification.
app.py
CHANGED
|
@@ -116,38 +116,51 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 116 |
# Basic user interface for company's view -Janika
|
| 117 |
with gr.Tab("User Interface"):
|
| 118 |
with gr.Row():
|
| 119 |
-
with gr.Column(scale=1, min_width=300):
|
| 120 |
-
# Summary
|
| 121 |
-
summary_output = gr.Textbox(label="Summary")
|
| 122 |
-
|
| 123 |
with gr.Column(scale=2, min_width=300):
|
| 124 |
-
#
|
| 125 |
-
|
| 126 |
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
|
| 131 |
# Testing Area -Piitu
|
| 132 |
with gr.Tab("Testing Area"):
|
| 133 |
with gr.Row():
|
| 134 |
-
|
|
|
|
| 135 |
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
|
| 141 |
-
|
| 142 |
-
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
| 152 |
|
| 153 |
demo.launch()
|
|
|
|
| 116 |
# Basic user interface for company's view -Janika
|
| 117 |
with gr.Tab("User Interface"):
|
| 118 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
with gr.Column(scale=2, min_width=300):
|
| 120 |
+
# Overall summary from all feedback
|
| 121 |
+
com_summary_output = gr.Textbox(label="Summary")
|
| 122 |
|
| 123 |
+
with gr.Column(scale=1, min_width=300):
|
| 124 |
+
# Average star rating across all feedback
|
| 125 |
+
com_star_rating = gr.HTML(value=show_stars())
|
| 126 |
+
|
| 127 |
+
# The most common keywords across all feedback
|
| 128 |
+
com_keywords_output = gr.Textbox(label="Keywords")
|
| 129 |
|
| 130 |
|
| 131 |
# Testing Area -Piitu
|
| 132 |
with gr.Tab("Testing Area"):
|
| 133 |
with gr.Row():
|
| 134 |
+
with gr.Column(scale=1, min_width=300):
|
| 135 |
+
name_input = gr.Textbox(label="Enter your name", placeholder="Enter your name here...")
|
| 136 |
|
| 137 |
+
text_input = gr.Textbox(label="Please give us feedback!",
|
| 138 |
+
placeholder="Enter your feedback here...",
|
| 139 |
+
max_length=5000)
|
| 140 |
+
|
| 141 |
+
# Update placeholder based on name input -Piitu
|
| 142 |
+
name_input.change(fn=update_placeholder, inputs=name_input, outputs=text_input)
|
| 143 |
+
|
| 144 |
+
# Send button -Piitu
|
| 145 |
+
send_button = gr.Button("Send")
|
| 146 |
|
| 147 |
+
# Output for feedback submission confirmation -Piitu
|
| 148 |
+
feedback_output = gr.Textbox(label="Submission Result", interactive=False)
|
| 149 |
|
| 150 |
+
# Link button to function that handles feedback submission -Piitu
|
| 151 |
+
send_button.click(handle_feedback, inputs=[text_input, name_input], outputs=feedback_output)
|
| 152 |
+
|
| 153 |
+
with gr.Column(scale=2, min_width=300):
|
| 154 |
+
# Estimated star rating from customer's feedback -Janika
|
| 155 |
+
cus_star_rating = gr.HTML(value=show_stars())
|
| 156 |
|
| 157 |
+
# Estimated sentiment from customer's feedback -Janika
|
| 158 |
+
cus_sentiment = gr.Textbox(label="Sentiment")
|
| 159 |
+
|
| 160 |
+
# Summary from customer's feedback -Janika
|
| 161 |
+
cus_summary_output = gr.Textbox(label="Summary")
|
| 162 |
|
| 163 |
+
# The most common keywords from customer's feedback -Janika
|
| 164 |
+
cus_keywords_output = gr.Textbox(label="Keywords")
|
| 165 |
|
| 166 |
demo.launch()
|