Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,20 @@ def transcribe(audio):
|
|
| 24 |
y /= np.max(np.abs(y))
|
| 25 |
return transcriber({"sampling_rate": sr, "raw": y})["text"]
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
demo = gr.Interface(
|
| 28 |
fn=transcribe,
|
| 29 |
inputs=gr.Audio(),
|
|
|
|
| 24 |
y /= np.max(np.abs(y))
|
| 25 |
return transcriber({"sampling_rate": sr, "raw": y})["text"]
|
| 26 |
|
| 27 |
+
|
| 28 |
+
# Manually prepare example file paths without metadata
|
| 29 |
+
examples = []
|
| 30 |
+
examples_dir = "examples"
|
| 31 |
+
if os.path.exists(examples_dir):
|
| 32 |
+
for filename in os.listdir(examples_dir):
|
| 33 |
+
if filename.endswith((".wav", ".mp3", ".ogg")):
|
| 34 |
+
examples.append([os.path.join(examples_dir, filename)])
|
| 35 |
+
|
| 36 |
+
print(f"Found {len(examples)} example files")
|
| 37 |
+
else:
|
| 38 |
+
print("Examples directory not found")
|
| 39 |
+
|
| 40 |
+
|
| 41 |
demo = gr.Interface(
|
| 42 |
fn=transcribe,
|
| 43 |
inputs=gr.Audio(),
|