Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 3 |
|
| 4 |
-
# Carga
|
| 5 |
-
tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-
|
| 6 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-
|
| 7 |
|
| 8 |
def responder(texto):
|
| 9 |
inputs = tokenizer(texto, return_tensors="pt")
|
|
@@ -15,10 +15,9 @@ iface = gr.Interface(
|
|
| 15 |
fn=responder,
|
| 16 |
inputs=gr.Textbox(lines=2, placeholder="Escribe tu pregunta aqu铆..."),
|
| 17 |
outputs="text",
|
| 18 |
-
title="Smart Bot - Chat con FLAN-T5-
|
| 19 |
-
description="
|
| 20 |
)
|
| 21 |
|
| 22 |
if __name__ == "__main__":
|
| 23 |
iface.launch()
|
| 24 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
| 3 |
|
| 4 |
+
# Carga modelo y tokenizador
|
| 5 |
+
tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-small")
|
| 6 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-small")
|
| 7 |
|
| 8 |
def responder(texto):
|
| 9 |
inputs = tokenizer(texto, return_tensors="pt")
|
|
|
|
| 15 |
fn=responder,
|
| 16 |
inputs=gr.Textbox(lines=2, placeholder="Escribe tu pregunta aqu铆..."),
|
| 17 |
outputs="text",
|
| 18 |
+
title="Smart Bot - Chat con FLAN-T5-Small",
|
| 19 |
+
description="Chatbot liviano con modelo FLAN-T5-Small en Hugging Face Spaces."
|
| 20 |
)
|
| 21 |
|
| 22 |
if __name__ == "__main__":
|
| 23 |
iface.launch()
|
|
|