mujtaba1212 commited on
Commit
c70a6c2
Β·
verified Β·
1 Parent(s): 3cd4a14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -243,7 +243,7 @@ def detect_api(image_b64: str) -> str:
243
  return json.dumps({"error": str(e)})
244
 
245
 
246
- # ── UI ────────────────────────────────────────────────────────────────────────
247
  with gr.Blocks(title="OrthoTimes Landmark Detection") as demo:
248
  gr.Markdown("## OrthoTimes QuickCephTool β€” HRNet Landmark Detection\nDetects 19 cephalometric landmarks automatically.")
249
 
@@ -255,11 +255,10 @@ with gr.Blocks(title="OrthoTimes Landmark Detection") as demo:
255
 
256
  gr.Button("β–Ά Detect Landmarks").click(fn=detect_visual, inputs=img_in, outputs=[img_out, json_out])
257
 
258
- gr.Interface(
259
- fn=detect_api,
260
- inputs=gr.Textbox(label="Base64 image"),
261
- outputs=gr.Textbox(label="JSON result"),
262
- api_name="detect"
263
- )
264
 
265
- demo.launch()
 
243
  return json.dumps({"error": str(e)})
244
 
245
 
246
+ # ── UI β€” single Blocks interface only, no nested Interface ────────────────────
247
  with gr.Blocks(title="OrthoTimes Landmark Detection") as demo:
248
  gr.Markdown("## OrthoTimes QuickCephTool β€” HRNet Landmark Detection\nDetects 19 cephalometric landmarks automatically.")
249
 
 
255
 
256
  gr.Button("β–Ά Detect Landmarks").click(fn=detect_visual, inputs=img_in, outputs=[img_out, json_out])
257
 
258
+ # API tab for programmatic access
259
+ with gr.Tab("API"):
260
+ b64_in = gr.Textbox(label="Base64 encoded image", lines=3)
261
+ b64_out = gr.Textbox(label="JSON result", lines=10)
262
+ gr.Button("Detect (API)").click(fn=detect_api, inputs=b64_in, outputs=b64_out)
 
263
 
264
+ demo.launch(server_name="0.0.0.0", server_port=7860)