kdevoe commited on
Commit
3a79ec1
·
verified ·
1 Parent(s): abb314b

Fixing outputs overlapping each other

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -67,12 +67,19 @@ css = """.my-group {max-width: 500px !important; max-height: 500px !important;}
67
  .my-column {display: flex !important; justify-content: center !important; align-items: center !important};"""
68
 
69
  with gr.Blocks(css=css) as demo:
70
- with gr.Column(elem_classes=["my-column"]):
71
- with gr.Group(elem_classes=["my-group"]):
 
 
72
  input_img = gr.Image(sources=["webcam"], type="numpy", streaming=True, label="Webcam Input")
 
73
  output_label = gr.Label(label="Predicted ASL Sign")
74
  output_plot = gr.Plot(label="Class Probabilities")
75
 
76
- input_img.stream(predict_asl, [input_img], [output_label, output_plot], time_limit=300, stream_every=0.5)
 
 
 
 
77
 
78
  demo.launch()
 
67
  .my-column {display: flex !important; justify-content: center !important; align-items: center !important};"""
68
 
69
  with gr.Blocks(css=css) as demo:
70
+ with gr.Row():
71
+ gr.Markdown("# ASL Recognition App")
72
+ with gr.Row():
73
+ with gr.Column(scale=1):
74
  input_img = gr.Image(sources=["webcam"], type="numpy", streaming=True, label="Webcam Input")
75
+ with gr.Column(scale=1):
76
  output_label = gr.Label(label="Predicted ASL Sign")
77
  output_plot = gr.Plot(label="Class Probabilities")
78
 
79
+ def gradio_pipeline(frame):
80
+ predicted_label, fig = predict_asl(frame)
81
+ return predicted_label, fig
82
+
83
+ input_img.stream(gradio_pipeline, [input_img], [output_label, output_plot], time_limit=30, stream_every=0.1)
84
 
85
  demo.launch()