Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,20 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
description_content = """
|
| 9 |
-
<b>Welcome to our Gradio App!</b><br>
|
| 10 |
-
For more details, check out our <a href="https://www.example.com" target="_blank">website</a>.
|
| 11 |
-
"""
|
| 12 |
|
| 13 |
-
# Gradio interface
|
| 14 |
iface = gr.Interface(
|
| 15 |
-
fn=
|
| 16 |
-
inputs=
|
| 17 |
-
outputs=
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
)
|
| 20 |
|
| 21 |
-
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import whisper
|
| 3 |
|
| 4 |
+
def convert_to_text(audio_path: str) -> str:
|
| 5 |
+
model = whisper.load_model("base")
|
| 6 |
+
result = model.transcribe(audio_path)
|
| 7 |
+
return result["text"]
|
| 8 |
|
| 9 |
+
audio_input = gr.inputs.Audio(type="file", label="Upload an Audio")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
|
|
|
| 11 |
iface = gr.Interface(
|
| 12 |
+
fn=convert_to_text,
|
| 13 |
+
inputs=audio_input,
|
| 14 |
+
outputs="text",
|
| 15 |
+
title="Transform your audio into text",
|
| 16 |
+
description="Upload an audio here, either from your mobile or laptop and get it transcribed in a matter of seconds.",
|
| 17 |
+
theme="Monochrome"
|
| 18 |
)
|
| 19 |
|
| 20 |
+
iface.launch()
|