gladguy commited on
Commit
766eaee
·
1 Parent(s): 629b772

Fix HF port issue and reorganize UI with more examples

Browse files
Files changed (1) hide show
  1. app.py +26 -19
app.py CHANGED
@@ -209,12 +209,6 @@ with gr.Blocks(title="AnatomyBot - MBBS Anatomy Tutor") as demo:
209
  # 🩺 AnatomyBot - Your MBBS Anatomy Tutor
210
 
211
  Ask questions about human anatomy and receive visual diagrams with key learning points!
212
-
213
- **Example questions:**
214
- - Show me the Circle of Willis
215
- - Brachial plexus anatomy
216
- - Heart chambers and valves
217
- - Layers of the scalp
218
  """
219
  )
220
 
@@ -225,6 +219,29 @@ with gr.Blocks(title="AnatomyBot - MBBS Anatomy Tutor") as demo:
225
  placeholder="e.g., Show me the Circle of Willis",
226
  lines=2
227
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  submit_btn = gr.Button("🔍 Search & Learn", variant="primary", size="lg")
229
  error_output = gr.Markdown(label="Status")
230
 
@@ -234,18 +251,6 @@ with gr.Blocks(title="AnatomyBot - MBBS Anatomy Tutor") as demo:
234
  with gr.Row():
235
  info_output = gr.Markdown(label="Key Points to Know")
236
 
237
- # Examples
238
- gr.Examples(
239
- examples=[
240
- ["Show me the Circle of Willis"],
241
- ["Brachial plexus anatomy"],
242
- ["Carpal bones arrangement"],
243
- ["Layers of the scalp"],
244
- ["Anatomy of the heart chambers"]
245
- ],
246
- inputs=query_input
247
- )
248
-
249
  # Event handler
250
  submit_btn.click(
251
  fn=process_anatomy_query,
@@ -266,4 +271,6 @@ if __name__ == "__main__":
266
  if not HYPERBOLIC_API_KEY or HYPERBOLIC_API_KEY == "your_hyperbolic_api_key_here":
267
  print("⚠️ WARNING: HYPERBOLIC_API_KEY not configured in .env file")
268
 
269
- demo.launch(share=False, server_name="0.0.0.0", server_port=7861)
 
 
 
209
  # 🩺 AnatomyBot - Your MBBS Anatomy Tutor
210
 
211
  Ask questions about human anatomy and receive visual diagrams with key learning points!
 
 
 
 
 
 
212
  """
213
  )
214
 
 
219
  placeholder="e.g., Show me the Circle of Willis",
220
  lines=2
221
  )
222
+
223
+ # Examples moved here - right below the text box
224
+ gr.Examples(
225
+ examples=[
226
+ ["Show me the Circle of Willis"],
227
+ ["Brachial plexus anatomy"],
228
+ ["Carpal bones arrangement"],
229
+ ["Layers of the scalp"],
230
+ ["Anatomy of the heart chambers"],
231
+ ["Cranial nerves and their functions"],
232
+ ["Structure of the kidney nephron"],
233
+ ["Branches of the abdominal aorta"],
234
+ ["Rotator cuff muscles"],
235
+ ["Spinal cord cross section"],
236
+ ["Femoral triangle anatomy"],
237
+ ["Larynx cartilages and membranes"],
238
+ ["Portal venous system"],
239
+ ["Anatomy of the eyeball"],
240
+ ["Bronchopulmonary segments"]
241
+ ],
242
+ inputs=query_input
243
+ )
244
+
245
  submit_btn = gr.Button("🔍 Search & Learn", variant="primary", size="lg")
246
  error_output = gr.Markdown(label="Status")
247
 
 
251
  with gr.Row():
252
  info_output = gr.Markdown(label="Key Points to Know")
253
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  # Event handler
255
  submit_btn.click(
256
  fn=process_anatomy_query,
 
271
  if not HYPERBOLIC_API_KEY or HYPERBOLIC_API_KEY == "your_hyperbolic_api_key_here":
272
  print("⚠️ WARNING: HYPERBOLIC_API_KEY not configured in .env file")
273
 
274
+ # Use environment variable for port, default to 7860 for HF Spaces
275
+ port = int(os.getenv("GRADIO_SERVER_PORT", "7860"))
276
+ demo.launch(server_name="0.0.0.0", server_port=port)