Ali2206 commited on
Commit
83aa052
·
verified ·
1 Parent(s): ef6f12c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -136
app.py CHANGED
@@ -158,154 +158,47 @@ def process_final_report(agent, file, chatbot_state: List[Dict[str, str]]) -> Tu
158
 
159
  def create_ui(agent):
160
  with gr.Blocks(css="""
161
- :root {
162
- --primary-color: #2563eb;
163
- --secondary-color: #1e40af;
164
- --bg-color: #f8fafc;
165
- --text-color: #1e293b;
166
- --user-bubble: #ffffff;
167
- --bot-bubble: #f1f5f9;
168
- --border-color: #e2e8f0;
169
- }
170
  body {
 
 
171
  font-family: 'Inter', sans-serif;
172
- background-color: var(--bg-color);
173
- color: var(--text-color);
174
  }
175
  .gradio-container {
176
- max-width: 800px;
177
- margin: 0 auto;
178
- padding: 20px;
179
- background-color: var(--bg-color);
180
- }
181
- .chat-container {
182
- display: flex;
183
- flex-direction: column;
184
- height: 80vh;
185
- border: 1px solid var(--border-color);
186
  border-radius: 12px;
187
- overflow: hidden;
188
- background-color: white;
189
- }
190
- .chat-header {
191
- padding: 16px;
192
- background-color: white;
193
- border-bottom: 1px solid var(--border-color);
194
- font-weight: 600;
195
- font-size: 18px;
196
- }
197
- .chat-messages {
198
- flex: 1;
199
- padding: 16px;
200
  overflow-y: auto;
201
- background-color: var(--bg-color);
202
  }
203
- .message {
204
- display: flex;
205
- margin-bottom: 16px;
206
- align-items: flex-start;
207
- }
208
- .message-avatar {
209
- width: 36px;
210
- height: 36px;
211
- border-radius: 50%;
212
- margin-right: 12px;
213
- background-color: var(--primary-color);
214
- color: white;
215
- display: flex;
216
- align-items: center;
217
- justify-content: center;
218
- font-weight: bold;
219
- }
220
- .message-content {
221
- max-width: 80%;
222
- }
223
- .user-message .message-content {
224
- margin-left: auto;
225
- background-color: var(--user-bubble);
226
- padding: 12px 16px;
227
- border-radius: 18px 18px 0 18px;
228
- box-shadow: 0 1px 2px rgba(0,0,0,0.1);
229
- }
230
- .bot-message .message-content {
231
- background-color: var(--bot-bubble);
232
- padding: 12px 16px;
233
- border-radius: 18px 18px 18px 0;
234
- box-shadow: 0 1px 2px rgba(0,0,0,0.1);
235
- }
236
- .message-time {
237
- font-size: 12px;
238
- color: #64748b;
239
- margin-top: 4px;
240
- }
241
- .chat-input-container {
242
- padding: 16px;
243
- background-color: white;
244
- border-top: 1px solid var(--border-color);
245
- }
246
- .file-upload {
247
- display: flex;
248
- gap: 8px;
249
- margin-bottom: 12px;
250
- }
251
- .upload-btn {
252
- flex: 1;
253
- }
254
- .analyze-btn {
255
- background-color: var(--primary-color);
256
  color: white;
 
257
  border: none;
258
- padding: 10px 16px;
259
  border-radius: 8px;
260
- cursor: pointer;
261
- font-weight: 500;
262
  }
263
- .analyze-btn:hover {
264
- background-color: var(--secondary-color);
265
- }
266
- .report-download {
267
- margin-top: 12px;
268
- padding: 12px;
269
- background-color: var(--bot-bubble);
270
- border-radius: 8px;
271
- display: none;
272
  }
273
  """) as demo:
274
- with gr.Column(elem_classes="chat-container"):
275
- gr.Markdown("""<div class="chat-header">Patient History AI Assistant</div>""")
276
-
277
- chatbot = gr.Chatbot(
278
- elem_classes="chat-messages",
279
- label=None,
280
- show_label=False,
281
- bubble_full_width=False,
282
- avatar_images=[
283
- "https://ui-avatars.com/api/?name=AI&background=2563eb&color=fff&size=128", # Bot avatar
284
- None # User avatar (default)
285
- ]
286
- )
287
-
288
- with gr.Column(elem_classes="chat-input-container"):
289
- with gr.Row(elem_classes="file-upload"):
290
- file_upload = gr.File(
291
- label="Upload Excel File",
292
- file_types=[".xlsx"],
293
- elem_classes="upload-btn",
294
- scale=4
295
- )
296
- analyze_btn = gr.Button(
297
- "Analyze",
298
- elem_classes="analyze-btn",
299
- scale=1
300
- )
301
-
302
- report_output = gr.File(
303
- label="Download Report",
304
- visible=False,
305
- interactive=False,
306
- elem_classes="report-download"
307
- )
308
-
309
  chatbot_state = gr.State(value=[])
310
 
311
  def update_ui(file, current_state):
@@ -327,4 +220,4 @@ if __name__ == "__main__":
327
  demo.launch(server_name="0.0.0.0", server_port=7860, allowed_paths=["/data/hf_cache/reports"], share=False)
328
  except Exception as e:
329
  print(f"Error: {str(e)}")
330
- sys.exit(1)
 
158
 
159
  def create_ui(agent):
160
  with gr.Blocks(css="""
 
 
 
 
 
 
 
 
 
161
  body {
162
+ background: #10141f;
163
+ color: #ffffff;
164
  font-family: 'Inter', sans-serif;
 
 
165
  }
166
  .gradio-container {
167
+ padding: 30px;
168
+ max-width: 900px;
169
+ margin: auto;
170
+ border-radius: 16px;
171
+ background-color: #1a1f2e;
172
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
173
+ }
174
+ .chatbot {
175
+ background-color: #131720;
 
176
  border-radius: 12px;
177
+ padding: 20px;
178
+ height: 600px;
 
 
 
 
 
 
 
 
 
 
 
179
  overflow-y: auto;
180
+ border: 1px solid #2c3344;
181
  }
182
+ .gr-button {
183
+ background: linear-gradient(135deg, #4b4ced, #37b6e9);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  color: white;
185
+ font-weight: 500;
186
  border: none;
187
+ padding: 10px 20px;
188
  border-radius: 8px;
189
+ transition: background 0.3s ease;
 
190
  }
191
+ .gr-button:hover {
192
+ background: linear-gradient(135deg, #37b6e9, #4b4ced);
 
 
 
 
 
 
 
193
  }
194
  """) as demo:
195
+ gr.Markdown("""# 🧠 Clinical Reasoning Assistant
196
+ Upload clinical Excel records below and click **Analyze** to generate a medical summary.
197
+ """)
198
+ chatbot = gr.Chatbot(elem_classes="chatbot")
199
+ file_upload = gr.File(label="Upload Excel File", file_types=[".xlsx"])
200
+ analyze_btn = gr.Button("Analyze")
201
+ report_output = gr.File(label="Download Report", visible=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  chatbot_state = gr.State(value=[])
203
 
204
  def update_ui(file, current_state):
 
220
  demo.launch(server_name="0.0.0.0", server_port=7860, allowed_paths=["/data/hf_cache/reports"], share=False)
221
  except Exception as e:
222
  print(f"Error: {str(e)}")
223
+ sys.exit(1)