Segizu commited on
Commit
6e6c263
verified
1 Parent(s): e1429a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -4
app.py CHANGED
@@ -3,8 +3,27 @@ import gradio as gr
3
  with gr.Blocks(fill_height=True) as demo:
4
  with gr.Sidebar():
5
  gr.Markdown("# Inference Provider")
6
- gr.Markdown("This Space showcases the Qwen/QwQ-32B model, served by the hyperbolic API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/Qwen/QwQ-32B", accept_token=button, provider="hyperbolic")
 
 
9
 
10
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  with gr.Blocks(fill_height=True) as demo:
4
  with gr.Sidebar():
5
  gr.Markdown("# Inference Provider")
6
+ gr.Markdown(
7
+ "Este Space muestra el modelo Qwen/QwQ-32B, servido por la API hyperbolic. "
8
+ "Inicia sesi贸n con tu cuenta de Hugging Face para usar esta API."
9
+ )
10
+ button = gr.LoginButton("Iniciar sesi贸n")
11
 
12
+ # Cargamos el modelo usando el token proporcionado por el bot贸n
13
+ model = gr.load("models/Qwen/QwQ-32B", accept_token=button, provider="hyperbolic")
14
+
15
+ # Definimos la funci贸n que llama a la API del modelo
16
+ def call_inference(prompt: str) -> str:
17
+ respuesta = model(prompt)
18
+ return respuesta
19
+
20
+ # Creamos la interfaz para enviar un prompt y mostrar la respuesta
21
+ with gr.Row():
22
+ input_text = gr.Textbox(label="Ingresa tu prompt", placeholder="Escribe aqu铆...")
23
+ output_text = gr.Textbox(label="Respuesta")
24
+
25
+ # Bot贸n que ejecuta la funci贸n de inferencia
26
+ infer_button = gr.Button("Generar")
27
+ infer_button.click(fn=call_inference, inputs=input_text, outputs=output_text)
28
+
29
+ demo.launch()