Elliot Sones commited on
Commit
578d1f6
·
1 Parent(s): 5fcc2e6

Fix: Make input components visible for JS interaction (hidden via CSS)

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -314,15 +314,22 @@ function sendStrokes() {
314
  # Gradio App
315
  # ============================================================================
316
 
317
- with gr.Blocks(title="Animal Doodle Classifier", theme=gr.themes.Soft()) as app:
 
 
 
 
 
 
318
  gr.Markdown("# 🎨 Animal Doodle Classifier")
319
  gr.Markdown("Draw an animal and click **Predict**! Supported: butterfly, cow, elephant, giraffe, monkey, octopus, scorpion, shark, snake, spider")
320
 
321
  with gr.Row():
322
  with gr.Column(scale=1):
323
  canvas = gr.HTML(CANVAS_HTML)
324
- strokes_input = gr.Textbox(label="Strokes", elem_id="strokes-input", visible=False)
325
- predict_btn = gr.Button("Predict", elem_id="predict-btn", visible=False)
 
326
 
327
  with gr.Column(scale=1):
328
  output = gr.Label(num_top_classes=5, label="Predictions")
 
314
  # Gradio App
315
  # ============================================================================
316
 
317
+ CSS = """
318
+ #strokes-input, #predict-btn {
319
+ display: none !important;
320
+ }
321
+ """
322
+
323
+ with gr.Blocks(title="Animal Doodle Classifier", theme=gr.themes.Soft(), css=CSS) as app:
324
  gr.Markdown("# 🎨 Animal Doodle Classifier")
325
  gr.Markdown("Draw an animal and click **Predict**! Supported: butterfly, cow, elephant, giraffe, monkey, octopus, scorpion, shark, snake, spider")
326
 
327
  with gr.Row():
328
  with gr.Column(scale=1):
329
  canvas = gr.HTML(CANVAS_HTML)
330
+ # visible=True so they are in DOM, hidden by CSS
331
+ strokes_input = gr.Textbox(label="Strokes", elem_id="strokes-input", visible=True)
332
+ predict_btn = gr.Button("Predict", elem_id="predict-btn", visible=True)
333
 
334
  with gr.Column(scale=1):
335
  output = gr.Label(num_top_classes=5, label="Predictions")