Rishi2455 commited on
Commit
c00677e
Β·
verified Β·
1 Parent(s): 1a5e3ed

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -83,6 +83,10 @@ def predict(pil_img: Image.Image) -> dict:
83
  }
84
  return emoji_labels
85
 
 
 
 
 
86
  # ── Gradio UI ────────────────────────────────────────────────────────────────
87
  DESCRIPTION = """
88
  Upload a photo of a person performing an activity, and the model will predict which of **15 activities** they are doing.
@@ -128,9 +132,8 @@ with gr.Blocks(
128
  height=380,
129
  )
130
  with gr.Row():
131
- clear_btn = gr.ClearButton(
132
- [image_input, label_output] if False else [image_input],
133
- value="πŸ—‘οΈ Clear",
134
  variant="secondary",
135
  size="lg",
136
  )
@@ -158,6 +161,11 @@ with gr.Blocks(
158
  )
159
 
160
  # Event handlers
 
 
 
 
 
161
  submit_btn.click(
162
  fn=predict,
163
  inputs=image_input,
 
83
  }
84
  return emoji_labels
85
 
86
+ def clear_all():
87
+ """Reset both image and predictions."""
88
+ return None, None
89
+
90
  # ── Gradio UI ────────────────────────────────────────────────────────────────
91
  DESCRIPTION = """
92
  Upload a photo of a person performing an activity, and the model will predict which of **15 activities** they are doing.
 
132
  height=380,
133
  )
134
  with gr.Row():
135
+ clear_btn = gr.Button(
136
+ "πŸ—‘οΈ Clear",
 
137
  variant="secondary",
138
  size="lg",
139
  )
 
161
  )
162
 
163
  # Event handlers
164
+ clear_btn.click(
165
+ fn=clear_all,
166
+ inputs=[],
167
+ outputs=[image_input, label_output],
168
+ )
169
  submit_btn.click(
170
  fn=predict,
171
  inputs=image_input,