Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
from transformers.pipelines.audio_utils import ffmpeg_microphone_live
|
| 3 |
import torch
|
|
|
|
| 4 |
|
| 5 |
asr_model = "openai/whisper-tiny.en"
|
| 6 |
nlp_model = "MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli"
|
|
@@ -36,6 +37,14 @@ while True:
|
|
| 36 |
top_label = output['labels'][0]
|
| 37 |
top_score = output['scores'][0]
|
| 38 |
print(f"Top Prediction: {top_label} with a score of {top_score:.2f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
from transformers.pipelines.audio_utils import ffmpeg_microphone_live
|
| 3 |
import torch
|
| 4 |
+
import gradio as gr
|
| 5 |
|
| 6 |
asr_model = "openai/whisper-tiny.en"
|
| 7 |
nlp_model = "MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli"
|
|
|
|
| 37 |
top_label = output['labels'][0]
|
| 38 |
top_score = output['scores'][0]
|
| 39 |
print(f"Top Prediction: {top_label} with a score of {top_score:.2f}")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
iface = gr.Interface(
|
| 43 |
+
fn=transcribe,
|
| 44 |
+
inputs=gr.inputs.Audio(source="microphone", type="filepath"),
|
| 45 |
+
outputs="text",
|
| 46 |
+
title="Real-Time ASR Transcription",
|
| 47 |
+
description="Speak into the microphone and get the real-time transcription."
|
| 48 |
+
)
|
| 49 |
|
| 50 |
+
iface.launch()
|
|
|