Create app.py (#1)
Browse files- Create app.py (4dabf03cf33fa00bf85c2aa4c5517ef2342894e3)
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from gradio_client import Client
|
| 2 |
+
def transcribe(audio, state=""):
|
| 3 |
+
client = Client( "abidlabs/whisper")
|
| 4 |
+
time.sleep(2)
|
| 5 |
+
text = client.predict(audio, api_name = '/predict')
|
| 6 |
+
state += text + " "
|
| 7 |
+
return state, state
|
| 8 |
+
|
| 9 |
+
# Set the starting state to an empty string
|
| 10 |
+
iface = gr. Interface(fn=transcribe,
|
| 11 |
+
inputs=[gr.Audio(source="microphone", type="filepath", streaming-True)," state"],
|
| 12 |
+
outputs=["textbox","state" ],
|
| 13 |
+
live=True)
|
| 14 |
+
iface.launch(share=True)
|