Rohith1112 commited on
Commit
4d50783
·
verified ·
1 Parent(s): 26a3610

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -68,8 +68,8 @@ def process_image(question):
68
  def chat_interface(question):
69
  global chat_history
70
  response = process_image(question)
71
- chat_history.append((question, response))
72
- return chat_history
73
 
74
 
75
  def upload_image(image):
@@ -81,7 +81,7 @@ def upload_image(image):
81
  # Gradio UI
82
  with gr.Blocks(theme="soft") as chat_ui:
83
  with gr.Row():
84
- # Sidebar
85
  with gr.Column(scale=1, min_width=200):
86
  gr.Markdown("### ChatGPT Menu")
87
  gr.Markdown("#### Today")
@@ -95,19 +95,14 @@ with gr.Blocks(theme="soft") as chat_ui:
95
  gr.Markdown("#### Upgrade Plan")
96
  gr.Markdown("More access to the best models")
97
 
98
- # Main chat area
99
  with gr.Column(scale=4):
100
  gr.Markdown("### ICliniq AI-Powered Medical Image Analysis")
101
- chat_list = gr.Chatbot(value=[], label="Chat History", elem_id="chat-history")
102
  uploaded_image = gr.File(label="Upload .npy Image", type="filepath")
103
  upload_status = gr.Textbox(label="Status", interactive=False)
104
  extracted_image = gr.Image(label="Extracted Images")
105
  question_input = gr.Textbox(label="Ask a question", placeholder="Ask something about the image...")
106
  submit_button = gr.Button("Send")
107
-
108
- # Upload and Processing Interactions
109
- uploaded_image.upload(upload_image, uploaded_image, [upload_status, extracted_image])
110
- submit_button.click(chat_interface, question_input, chat_list)
111
- question_input.submit(chat_interface, question_input, chat_list)
112
 
113
- chat_ui.launch()
 
68
  def chat_interface(question):
69
  global chat_history
70
  response = process_image(question)
71
+ chat_history.append((question, response)) # Save dynamic chat history
72
+ return chat_history # Return updated chat history
73
 
74
 
75
  def upload_image(image):
 
81
  # Gradio UI
82
  with gr.Blocks(theme="soft") as chat_ui:
83
  with gr.Row():
84
+ # Static Sidebar
85
  with gr.Column(scale=1, min_width=200):
86
  gr.Markdown("### ChatGPT Menu")
87
  gr.Markdown("#### Today")
 
95
  gr.Markdown("#### Upgrade Plan")
96
  gr.Markdown("More access to the best models")
97
 
98
+ # Center Chat Area
99
  with gr.Column(scale=4):
100
  gr.Markdown("### ICliniq AI-Powered Medical Image Analysis")
101
+ chat_list = gr.Chatbot(value=[], label="Chat History", elem_id="chat-history") # Dynamic chat
102
  uploaded_image = gr.File(label="Upload .npy Image", type="filepath")
103
  upload_status = gr.Textbox(label="Status", interactive=False)
104
  extracted_image = gr.Image(label="Extracted Images")
105
  question_input = gr.Textbox(label="Ask a question", placeholder="Ask something about the image...")
106
  submit_button = gr.Button("Send")
 
 
 
 
 
107
 
108
+