Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -257,32 +257,23 @@ if __name__ == "__main__":
|
|
| 257 |
flask_thread.start()
|
| 258 |
|
| 259 |
# Gradio interface
|
| 260 |
-
with gr.Blocks() as interface:
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
# Right Column
|
| 279 |
-
with gr.Column(scale=1):
|
| 280 |
-
pain_result = gr.Textbox(label="Pain Detection Result", interactive=False)
|
| 281 |
-
average_pain = gr.Textbox(label="Average Pain", interactive=False)
|
| 282 |
-
graph_output = gr.Image(label="Pain Detection Graph")
|
| 283 |
-
|
| 284 |
-
# State to store intermediate values
|
| 285 |
-
state = gr.State({"result": "", "average_pain": "", "graph_filename": ""})
|
| 286 |
|
| 287 |
# Clear button resets the UI, including the file input, chatbot input, and outputs
|
| 288 |
clear_button.click(lambda: (None, None, "", "",""), outputs=[pain_result, average_pain, graph_output, chatbot_output, file_input])
|
|
|
|
| 257 |
flask_thread.start()
|
| 258 |
|
| 259 |
# Gradio interface
|
| 260 |
+
with gr.Blocks() as interface:
|
| 261 |
+
gr.Markdown("""<div style="text-align:center; margin-top:20px;"><h1>PainSense: AI-Driven Pain Detection and Chatbot Assistance</h1></div>""")
|
| 262 |
+
with gr.Row():
|
| 263 |
+
with gr.Column(scale=1):
|
| 264 |
+
file_input = gr.File(label="Upload Audio or Video File")
|
| 265 |
+
with gr.Row(): # Place buttons next to each other
|
| 266 |
+
clear_button = gr.Button("Clear", elem_id="clear_btn")
|
| 267 |
+
submit_button = gr.Button("Submit", variant="primary", elem_id="submit_button")
|
| 268 |
+
chatbot_input = gr.Textbox(label="Chat with AI", placeholder="Ask a question...", interactive=True)
|
| 269 |
+
chatbot_output = gr.Textbox(label="Chatbot Response", interactive=False)
|
| 270 |
+
|
| 271 |
+
with gr.Column(scale=1):
|
| 272 |
+
pain_result = gr.Textbox(label="Pain Detection Result")
|
| 273 |
+
average_pain = gr.Textbox(label="Average Pain")
|
| 274 |
+
graph_output = gr.Image(label="Pain Detection Graph")
|
| 275 |
+
|
| 276 |
+
state = gr.State({"result": "", "average_pain": "", "graph_filename": ""})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
|
| 278 |
# Clear button resets the UI, including the file input, chatbot input, and outputs
|
| 279 |
clear_button.click(lambda: (None, None, "", "",""), outputs=[pain_result, average_pain, graph_output, chatbot_output, file_input])
|