Spaces:
Build error
Build error
Download app.py from bgabriel3710/faqSupportBot: direct link, hf CLI and curl.
- Browser
- Download file 502 Bytes
-
https://huggingface.co/spaces/bgabriel3710/faqSupportBot/resolve/main/app.py
- Command line
-
hf download hf://spaces/bgabriel3710/faqSupportBot/app.py
-
curl -L -o app.py https://huggingface.co/spaces/bgabriel3710/faqSupportBot/resolve/main/app.py
502 Bytes
| # 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() | |