Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -4,16 +4,16 @@ import os
|
|
4 |
from pydub import AudioSegment
|
5 |
import tempfile
|
6 |
|
|
|
7 |
# Model ID from Hugging Face
|
8 |
model_id = "Quantamhash/Quantum_STT"
|
9 |
|
10 |
-
# Load the speech recognition pipeline
|
11 |
pipe = pipeline(
|
12 |
"automatic-speech-recognition",
|
13 |
model=model_id,
|
14 |
generate_kwargs={"language": "en", "task": "transcribe"},
|
15 |
-
tokenizer=model_id
|
16 |
-
device=-1 # Use CPU
|
17 |
)
|
18 |
|
19 |
def convert_to_wav(input_path):
|
@@ -44,6 +44,7 @@ def transcribe(audio):
|
|
44 |
except Exception as e:
|
45 |
return f"An unexpected error occurred: {str(e)}"
|
46 |
|
|
|
47 |
# Gradio interface
|
48 |
interface = gr.Interface(
|
49 |
fn=transcribe,
|
@@ -58,4 +59,4 @@ interface = gr.Interface(
|
|
58 |
)
|
59 |
|
60 |
# Launch the interface
|
61 |
-
interface.launch()
|
|
|
4 |
from pydub import AudioSegment
|
5 |
import tempfile
|
6 |
|
7 |
+
|
8 |
# Model ID from Hugging Face
|
9 |
model_id = "Quantamhash/Quantum_STT"
|
10 |
|
11 |
+
# Load the speech recognition pipeline
|
12 |
pipe = pipeline(
|
13 |
"automatic-speech-recognition",
|
14 |
model=model_id,
|
15 |
generate_kwargs={"language": "en", "task": "transcribe"},
|
16 |
+
tokenizer=model_id
|
|
|
17 |
)
|
18 |
|
19 |
def convert_to_wav(input_path):
|
|
|
44 |
except Exception as e:
|
45 |
return f"An unexpected error occurred: {str(e)}"
|
46 |
|
47 |
+
|
48 |
# Gradio interface
|
49 |
interface = gr.Interface(
|
50 |
fn=transcribe,
|
|
|
59 |
)
|
60 |
|
61 |
# Launch the interface
|
62 |
+
interface.launch()
|