Claude commited on
Commit
7ab16ce
·
unverified ·
1 Parent(s): 55955ce

fix: resolve Gradio SSR crash and Error badges on HF Spaces

Browse files

- Replace gr.Number(precision=0) with gr.Textbox for todo ID input
to avoid gradio_client JSON schema bug (bool not iterable)
- Disable SSR mode in launch() to prevent "No API found" error
- Pin gradio==5.12.0 to match sdk_version in README
- Expose demo at module level for HF Spaces auto-discovery

https://claude.ai/code/session_01TGQvouqnomLvJVhu7TZXGP

Files changed (2) hide show
  1. app.py +3 -3
  2. requirements.txt +1 -1
app.py CHANGED
@@ -738,7 +738,7 @@ def build_app():
738
  with gr.Tab("Todos", id="todos-tab"):
739
  gr.Markdown("*All your extracted to-do items, organized as cards. Use the todo ID shown on each card to toggle it.*")
740
  with gr.Row():
741
- todo_id_input = gr.Number(label="Todo ID", precision=0, scale=1)
742
  toggle_btn = gr.Button("Toggle Done", variant="secondary", size="sm", scale=1)
743
  todos_html = gr.HTML(
744
  value="<div style='text-align:center;padding:40px;color:#6b7b8d;'>No todos yet.</div>",
@@ -833,7 +833,7 @@ Built by **[Alpha AI](https://www.alphaai.biz)** — Intelligent solutions for t
833
  # ---------------------------------------------------------------------------
834
 
835
  init_db()
 
836
 
837
  if __name__ == "__main__":
838
- app = build_app()
839
- app.launch(server_name="0.0.0.0", server_port=7860)
 
738
  with gr.Tab("Todos", id="todos-tab"):
739
  gr.Markdown("*All your extracted to-do items, organized as cards. Use the todo ID shown on each card to toggle it.*")
740
  with gr.Row():
741
+ todo_id_input = gr.Textbox(label="Todo ID", placeholder="Enter todo ID number", scale=1)
742
  toggle_btn = gr.Button("Toggle Done", variant="secondary", size="sm", scale=1)
743
  todos_html = gr.HTML(
744
  value="<div style='text-align:center;padding:40px;color:#6b7b8d;'>No todos yet.</div>",
 
833
  # ---------------------------------------------------------------------------
834
 
835
  init_db()
836
+ demo = build_app()
837
 
838
  if __name__ == "__main__":
839
+ demo.launch(server_name="0.0.0.0", server_port=7860, ssr_mode=False)
 
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
- gradio>=5.0.0
2
  httpx>=0.27.0
3
  Pillow>=10.0.0
 
1
+ gradio==5.12.0
2
  httpx>=0.27.0
3
  Pillow>=10.0.0