Spaces:
Running
on
Zero
Running
on
Zero
feat: Enable MCP
#4
by
multimodalart
HF Staff
- opened
app.py
CHANGED
|
@@ -29,7 +29,21 @@ LANGUAGES = {
|
|
| 29 |
|
| 30 |
@spaces.GPU()
|
| 31 |
def process_audio(audio_path, model_name, lang_name, max_tokens=500):
|
| 32 |
-
"""Process audio with selected Voxtral model and return the generated response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
if not audio_path:
|
| 34 |
return "Please upload an audio file."
|
| 35 |
|
|
@@ -111,4 +125,4 @@ with gr.Blocks(title="Voxtral Demo") as demo:
|
|
| 111 |
|
| 112 |
# Launch the app
|
| 113 |
if __name__ == "__main__":
|
| 114 |
-
demo.queue().launch(share=False, ssr_mode=False)
|
|
|
|
| 29 |
|
| 30 |
@spaces.GPU()
|
| 31 |
def process_audio(audio_path, model_name, lang_name, max_tokens=500):
|
| 32 |
+
"""Process audio with selected Voxtral model and return the generated response.
|
| 33 |
+
|
| 34 |
+
This function takes an audio file and processes it using the selected Voxtral model
|
| 35 |
+
to generate a transcription in the specified language.
|
| 36 |
+
|
| 37 |
+
Args:
|
| 38 |
+
audio_path: Path to the audio file to be transcribed.
|
| 39 |
+
model_name: Name of the Voxtral model to use ("Voxtral Mini (3B)" or "Voxtral Small (24B)").
|
| 40 |
+
lang_name: Name of the language for transcription (e.g., "English", "French", etc.).
|
| 41 |
+
max_tokens: Maximum number of tokens to generate in the output (default: 500).
|
| 42 |
+
|
| 43 |
+
Returns:
|
| 44 |
+
String containing the transcribed text from the audio file, or an error message
|
| 45 |
+
if the audio file is missing or an invalid model is selected.
|
| 46 |
+
"""
|
| 47 |
if not audio_path:
|
| 48 |
return "Please upload an audio file."
|
| 49 |
|
|
|
|
| 125 |
|
| 126 |
# Launch the app
|
| 127 |
if __name__ == "__main__":
|
| 128 |
+
demo.queue().launch(share=False, ssr_mode=False, mcp_server=True)
|