Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -192,31 +192,4 @@ async def synthesize(text: str):
|
|
| 192 |
temp_file,
|
| 193 |
media_type="audio/wav",
|
| 194 |
background=BackgroundTask(os.remove, temp_file)
|
| 195 |
-
)
|
| 196 |
-
|
| 197 |
-
BATCH_SIZE = 8
|
| 198 |
-
MODEL_NAME = "rbcurzon/whisper-medium-ph"
|
| 199 |
-
|
| 200 |
-
def transcribe(inputs, task):
|
| 201 |
-
if inputs is None:
|
| 202 |
-
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
| 203 |
-
|
| 204 |
-
text = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task, "language": "tagalog"}, return_timestamps=True)["text"]
|
| 205 |
-
return text
|
| 206 |
-
|
| 207 |
-
demo = gr.Blocks()
|
| 208 |
-
|
| 209 |
-
mf_transcribe = gr.Interface(
|
| 210 |
-
fn=transcribe,
|
| 211 |
-
inputs=[
|
| 212 |
-
gr.Audio(sources="microphone", type="filepath"),
|
| 213 |
-
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
|
| 214 |
-
],
|
| 215 |
-
outputs="text",
|
| 216 |
-
)
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
with demo:
|
| 220 |
-
gr.TabbedInterface([mf_transcribe], ["Microphone"])
|
| 221 |
-
|
| 222 |
-
demo.launch(debug=True)
|
|
|
|
| 192 |
temp_file,
|
| 193 |
media_type="audio/wav",
|
| 194 |
background=BackgroundTask(os.remove, temp_file)
|
| 195 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|