Spaces:
Build error

File size: 502 Bytes
cef89c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ab3aad6
cef89c1
ea3ce7a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# app.py
import gradio as gr
from transformers import pipeline

# Cargar modelo ligero optimizado para instrucciones
model = pipeline("text2text-generation", model="google/flan-t5-base")

def answer_question(prompt):
    response = model(prompt, max_new_tokens=256)[0]["generated_text"]
    return response

# Crear una interfaz tipo API con JSON
app = gr.Interface(
    fn=answer_question,
    inputs=gr.Text(label="Prompt"),
    outputs=gr.Text(label="Respuesta"),
)

app.launch()