Spaces:
Runtime error
Runtime error
edited seamless_client name
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ import PIL
|
|
| 13 |
from openai import OpenAI
|
| 14 |
dotenv.load_dotenv()
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
|
| 19 |
|
|
@@ -27,7 +27,7 @@ def process_speech(audio):
|
|
| 27 |
sr, data = audio
|
| 28 |
write(audio_name, sr, data.astype(np.int16))
|
| 29 |
|
| 30 |
-
out =
|
| 31 |
"S2TT",
|
| 32 |
"file",
|
| 33 |
None,
|
|
|
|
| 13 |
from openai import OpenAI
|
| 14 |
dotenv.load_dotenv()
|
| 15 |
|
| 16 |
+
seamless_client = Client("facebook/seamless_m4t")
|
| 17 |
|
| 18 |
|
| 19 |
|
|
|
|
| 27 |
sr, data = audio
|
| 28 |
write(audio_name, sr, data.astype(np.int16))
|
| 29 |
|
| 30 |
+
out = seamless_client.predict(
|
| 31 |
"S2TT",
|
| 32 |
"file",
|
| 33 |
None,
|
test.py
CHANGED
|
@@ -1,36 +1,7 @@
|
|
| 1 |
-
import dotenv
|
| 2 |
-
import base64
|
| 3 |
-
import os
|
| 4 |
-
import requests
|
| 5 |
import gradio as gr
|
| 6 |
-
import PIL
|
| 7 |
-
import numpy as np
|
| 8 |
-
from scipy.io.wavfile import write
|
| 9 |
-
import gradio_client as grc
|
| 10 |
-
dotenv.load_dotenv()
|
| 11 |
|
| 12 |
-
client = grc.Client("facebook/seamless_m4t")
|
| 13 |
def process_image(audio):
|
| 14 |
-
|
| 15 |
-
audio_name = f"{1}.wav"
|
| 16 |
-
sr, data = audio
|
| 17 |
-
write(audio_name, sr, data.astype(np.int16))
|
| 18 |
|
| 19 |
-
|
| 20 |
-
"S2TT",
|
| 21 |
-
"file",
|
| 22 |
-
None,
|
| 23 |
-
audio_name,
|
| 24 |
-
"",
|
| 25 |
-
"French",# source language
|
| 26 |
-
"English",# target language
|
| 27 |
-
api_name="/run",
|
| 28 |
-
)
|
| 29 |
-
out = out[1] # get the text
|
| 30 |
-
try :
|
| 31 |
-
return f"{out}"
|
| 32 |
-
except Exception as e :
|
| 33 |
-
return f"{e}"
|
| 34 |
-
|
| 35 |
-
iface = gr.Interface(fn=process_image, inputs="audio", outputs="text")
|
| 36 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
| 3 |
def process_image(audio):
|
| 4 |
+
return str(len(audio))
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
iface = gr.Interface(fn=process_image, inputs=["textbox","audio"], outputs="text")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
iface.launch()
|