Spaces:
Sleeping
Sleeping
Gijs Wijngaard commited on
Commit ·
5d67727
1
Parent(s): e1902b7
init
Browse files- app.py +4 -5
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -3,6 +3,9 @@ import torch
|
|
| 3 |
from pyannote.audio import Pipeline
|
| 4 |
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
def analyze_audio(audio_path: str, hf_token: str) -> dict:
|
| 7 |
if not audio_path:
|
| 8 |
return {"message": "Please upload an audio file."}
|
|
@@ -72,11 +75,7 @@ with gr.Blocks(title="Speaker Diarization") as demo:
|
|
| 72 |
summary = gr.Textbox(label="Summary", lines=10)
|
| 73 |
details = gr.JSON(label="Details")
|
| 74 |
|
| 75 |
-
|
| 76 |
-
result = analyze_audio(audio_path, token)
|
| 77 |
-
return result.get("message", ""), result
|
| 78 |
-
|
| 79 |
-
submit_btn.click(_run, [audio_input, hf_token], [summary, details])
|
| 80 |
|
| 81 |
|
| 82 |
if __name__ == "__main__":
|
|
|
|
| 3 |
from pyannote.audio import Pipeline
|
| 4 |
|
| 5 |
|
| 6 |
+
import spaces
|
| 7 |
+
|
| 8 |
+
@spaces.GPU
|
| 9 |
def analyze_audio(audio_path: str, hf_token: str) -> dict:
|
| 10 |
if not audio_path:
|
| 11 |
return {"message": "Please upload an audio file."}
|
|
|
|
| 75 |
summary = gr.Textbox(label="Summary", lines=10)
|
| 76 |
details = gr.JSON(label="Details")
|
| 77 |
|
| 78 |
+
submit_btn.click(analyze_audio, [audio_input, hf_token], [summary, details])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
requirements.txt
CHANGED
|
@@ -5,4 +5,5 @@ pyannote.core>=5.0.0
|
|
| 5 |
pyannote.metrics>=3.2.1
|
| 6 |
librosa>=0.10.1
|
| 7 |
soundfile>=0.12.1
|
|
|
|
| 8 |
|
|
|
|
| 5 |
pyannote.metrics>=3.2.1
|
| 6 |
librosa>=0.10.1
|
| 7 |
soundfile>=0.12.1
|
| 8 |
+
spaces
|
| 9 |
|