Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,22 +33,7 @@ def zero_shot(doc, candidates, aud):
|
|
| 33 |
print("here is the audio transcribed: ", aud)
|
| 34 |
return dict(zip(labels, scores))
|
| 35 |
|
| 36 |
-
#create input and output objects
|
| 37 |
-
#input object1
|
| 38 |
-
input1 = gr.Textbox(label="Text")
|
| 39 |
-
#input object 2
|
| 40 |
-
input2 = gr.Textbox(label="Labels")
|
| 41 |
|
| 42 |
-
#input 3 microphone
|
| 43 |
-
audio = gr.Audio(
|
| 44 |
-
label="Input Audio",
|
| 45 |
-
show_label=False,
|
| 46 |
-
source="microphone",
|
| 47 |
-
type="filepath"
|
| 48 |
-
)
|
| 49 |
-
|
| 50 |
-
#output object
|
| 51 |
-
output = gr.Label(label="Output")
|
| 52 |
|
| 53 |
#example object
|
| 54 |
'''examples = [
|
|
@@ -58,12 +43,27 @@ output = gr.Label(label="Output")
|
|
| 58 |
]
|
| 59 |
'''
|
| 60 |
#create interface
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
#display the interface
|
| 69 |
gui.launch()
|
|
|
|
| 33 |
print("here is the audio transcribed: ", aud)
|
| 34 |
return dict(zip(labels, scores))
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
#example object
|
| 39 |
'''examples = [
|
|
|
|
| 43 |
]
|
| 44 |
'''
|
| 45 |
#create interface
|
| 46 |
+
with gr.Blocks() as gui:
|
| 47 |
+
#create input and output objects
|
| 48 |
+
#input object1
|
| 49 |
+
input1 = gr.Textbox(label="Text")
|
| 50 |
+
#input object 2
|
| 51 |
+
input2 = gr.Textbox(label="Labels")
|
| 52 |
+
#input 3 microphone
|
| 53 |
+
audio = gr.Audio(
|
| 54 |
+
label="Input Audio",
|
| 55 |
+
show_label=False,
|
| 56 |
+
source="microphone",
|
| 57 |
+
type="filepath"
|
| 58 |
+
)
|
| 59 |
+
transcribeButton = gr.Button("Transcribe")
|
| 60 |
+
runButton = gr.Button("Run")
|
| 61 |
+
|
| 62 |
+
transcribeButton.click(fn=transcribe,inputs=audio, outputs=[input1])
|
| 63 |
+
#output object
|
| 64 |
+
output = gr.Label(label="Output")
|
| 65 |
+
|
| 66 |
+
runButton.click(fn=zero_shot, inputs=[inout1, input2], outputs=[output])
|
| 67 |
|
| 68 |
#display the interface
|
| 69 |
gui.launch()
|