Spaces:
Sleeping
Sleeping
File size: 945 Bytes
eb24ea7 1890a3d 7433820 1890a3d eb24ea7 1890a3d eb24ea7 1890a3d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import gradio as gr
import whisper
import requests
# Cargar el modelo Whisper Medium
modelo = whisper.load_model("medium")
# URL del servidor LLaMA en Google Colab (se actualizará más adelante)
LLAMA_SERVER_URL = "https://your-colab-server-url/run_llama"
# Función para transcribir el audio y enviarlo a LLaMA 2
def transcribir_y_enviar(audio):
transcripcion = modelo.transcribe(audio)["text"]
# Enviar texto transcrito al servidor de LLaMA 2 en Google Colab
respuesta = requests.post(LLAMA_SERVER_URL, json={"texto": transcripcion})
return respuesta.json().get("respuesta", "Error en el servidor de LLaMA")
# Interfaz en Gradio
interfaz = gr.Interface(
fn=transcribir_y_enviar,
inputs=gr.Audio(type="filepath"),
outputs="text",
title="Chatbot de Miopía Magna",
description="Sube un audio y el chatbot responderá."
)
# Ejecutar el servidor
if __name__ == "__main__":
interfaz.launch()
|