Spaces:
Runtime error
Runtime error
import dotenv | |
import base64 | |
import os | |
import requests | |
import gradio as gr | |
import PIL | |
import numpy as np | |
from scipy.io.wavfile import write | |
import gradio_client as grc | |
dotenv.load_dotenv() | |
client = grc.Client("facebook/seamless_m4t") | |
def process_image(audio): | |
# audio_name = f"{np.random.randint(0, 100)}.jpg" | |
audio_name = f"{1}.wav" | |
sr, data = audio | |
write(audio_name, sr, data.astype(np.int16)) | |
out = client.predict( | |
"S2TT", | |
"file", | |
None, | |
audio_name, | |
"", | |
"French",# source language | |
"English",# target language | |
api_name="/run", | |
) | |
out = out[1] # get the text | |
try : | |
return f"{out}" | |
except Exception as e : | |
return f"{e}" | |
iface = gr.Interface(fn=process_image, inputs="audio", outputs="text") | |
iface.launch() |