Spaces:
Running
on
Zero
Running
on
Zero
khang119966
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -256,6 +256,22 @@ chat_demo_interface = gr.ChatInterface(
|
|
256 |
theme='NoCrypt/miku'
|
257 |
)
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
mic_transcribe = gr.Interface(
|
260 |
fn=transcribe_speech,
|
261 |
inputs=gr.Audio(sources="microphone", type="filepath"),
|
|
|
256 |
theme='NoCrypt/miku'
|
257 |
)
|
258 |
|
259 |
+
from transformers import pipeline
|
260 |
+
|
261 |
+
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-large-v3-turbo")
|
262 |
+
|
263 |
+
def transcribe_speech(filepath):
|
264 |
+
output = pipe(
|
265 |
+
filepath,
|
266 |
+
max_new_tokens=256,
|
267 |
+
generate_kwargs={
|
268 |
+
"task": "transcribe",
|
269 |
+
},
|
270 |
+
chunk_length_s=30,
|
271 |
+
batch_size=1,
|
272 |
+
)
|
273 |
+
return output["text"]
|
274 |
+
|
275 |
mic_transcribe = gr.Interface(
|
276 |
fn=transcribe_speech,
|
277 |
inputs=gr.Audio(sources="microphone", type="filepath"),
|