MerlenMaven commited on
Commit
b25248f
·
verified ·
1 Parent(s): 67d7c6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -17
app.py CHANGED
@@ -257,23 +257,32 @@ if __name__ == "__main__":
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])
 
257
  flask_thread.start()
258
 
259
  # Gradio interface
260
+ with gr.Blocks() as interface:
261
+ # Title
262
+ gr.Markdown("""
263
+ <div style="text-align:center; margin-top:20px;">
264
+ <h1>PainSense: AI-Driven Pain Detection and Chatbot Assistance</h1>
265
+ </div>
266
+ """)
267
+
268
+ with gr.Row():
269
+ # Left Column
270
+ with gr.Column(scale=1):
271
+ file_input = gr.File(label="Upload Audio or Video File", file_types=["audio", "video"])
272
+ with gr.Row(): # Place buttons side by side
273
+ clear_button = gr.Button("Clear", elem_id="clear_btn")
274
+ submit_button = gr.Button("Submit", variant="primary", elem_id="submit_button")
275
+ chatbot_input = gr.Textbox(label="Chat with AI", placeholder="Ask a question...", interactive=True)
276
+ chatbot_output = gr.Textbox(label="Chatbot Response", interactive=False)
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])