Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,25 @@
|
|
| 1 |
-
|
| 2 |
-
import whisper
|
| 3 |
|
| 4 |
-
|
| 5 |
-
model = whisper.load_model("base")
|
| 6 |
-
result = model.transcribe(audio_path)
|
| 7 |
-
return result["text"]
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
iface = gr.Interface(
|
| 13 |
-
fn=
|
| 14 |
-
inputs=
|
| 15 |
-
outputs="
|
| 16 |
-
|
| 17 |
-
description="Upload an audio here, either from your mobile or laptop and get it transcribed in a matter of seconds.",
|
| 18 |
-
theme="Monochrome"
|
| 19 |
)
|
| 20 |
|
| 21 |
iface.launch()
|
|
|
|
| 1 |
+
# app.py
|
|
|
|
| 2 |
|
| 3 |
+
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
# Custom function to return HTML output
|
| 6 |
+
def custom_html_output(input_text):
|
| 7 |
+
return {
|
| 8 |
+
"html": f"<div style='color: blue; border: 1px solid black; padding: 10px;'>Your input was: {input_text}</div>"
|
| 9 |
+
}
|
| 10 |
|
| 11 |
+
# Description with custom HTML
|
| 12 |
+
description_content = """
|
| 13 |
+
<b>Welcome to our Gradio App!</b><br>
|
| 14 |
+
For more details, check out our <a href="https://www.example.com" target="_blank">website</a>.
|
| 15 |
+
"""
|
| 16 |
|
| 17 |
+
# Gradio interface
|
| 18 |
iface = gr.Interface(
|
| 19 |
+
fn=custom_html_output,
|
| 20 |
+
inputs="text",
|
| 21 |
+
outputs={"html": "html"},
|
| 22 |
+
description=description_content
|
|
|
|
|
|
|
| 23 |
)
|
| 24 |
|
| 25 |
iface.launch()
|