Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 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)
|