anayat1337 commited on
Commit
91936e7
1 Parent(s): 171fe3d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline(
5
+ "automatic-speech-recognition",
6
+ model="openai/whisper-small",
7
+ chunk_length_s=30,
8
+ device=device,
9
+ )
10
+
11
+ def predict(input_img):
12
+ predictions = pipeline(input_img)
13
+ return input_img, {p["label"]: p["score"] for p in predictions}
14
+
15
+ gradio_app = gr.Interface(
16
+ predict,
17
+ inputs=gr.Image(label="Select hot dog candidate", sources=['upload', 'webcam'], type="pil"),
18
+ outputs=[gr.Image(label="Processed Image"), gr.Label(label="Result", num_top_classes=2)],
19
+ title="Hot Dog? Or Not?",
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ gradio_app.launch()