Qwen-QwQ-32B / app.py
Segizu's picture
Update app.py
67c4f81 verified
raw
history blame
1.14 kB
import gradio as gr
with gr.Blocks(fill_height=True) as demo:
with gr.Sidebar():
gr.Markdown("# Inference Provider")
gr.Markdown(
"Este Space muestra el modelo Qwen/QwQ-32B, servido por la API hyperbolic. "
"Inicia sesi贸n con tu cuenta de Hugging Face para usar esta API."
)
button = gr.LoginButton("Iniciar sesi贸n")
# Cargamos el modelo usando el token proporcionado por el bot贸n
model = gr.load("models/microsoft/phi-4", accept_token=button, provider="hyperbolic")
# Definimos la funci贸n que llama a la API del modelo
def call_inference(prompt: str) -> str:
respuesta = model(prompt)
return respuesta
# Creamos la interfaz para enviar un prompt y mostrar la respuesta
with gr.Row():
input_text = gr.Textbox(label="Ingresa tu prompt", placeholder="Escribe aqu铆...")
output_text = gr.Textbox(label="Respuesta")
# Bot贸n que ejecuta la funci贸n de inferencia
infer_button = gr.Button("Generar")
infer_button.click(fn=call_inference, inputs=input_text, outputs=output_text)
demo.launch()