Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,12 +3,12 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
3 |
import torch
|
4 |
|
5 |
# Cargar el modelo y el tokenizador
|
6 |
-
model_name = "
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
-
model = AutoModelForCausalLM.from_pretrained(model_name
|
9 |
|
10 |
-
def generate_response(prompt, max_length=
|
11 |
-
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
12 |
|
13 |
with torch.no_grad():
|
14 |
outputs = model.generate(
|
@@ -41,8 +41,8 @@ iface = gr.Interface(
|
|
41 |
fn=chatbot,
|
42 |
inputs=["text", "state"],
|
43 |
outputs=["chatbot", "state"],
|
44 |
-
title="Tu Compañero AI con
|
45 |
-
description="Un chatbot de IA utilizando el modelo
|
46 |
)
|
47 |
|
48 |
iface.launch()
|
|
|
3 |
import torch
|
4 |
|
5 |
# Cargar el modelo y el tokenizador
|
6 |
+
model_name = "distilgpt2"
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
9 |
|
10 |
+
def generate_response(prompt, max_length=100):
|
11 |
+
inputs = tokenizer.encode(prompt, return_tensors="pt")
|
12 |
|
13 |
with torch.no_grad():
|
14 |
outputs = model.generate(
|
|
|
41 |
fn=chatbot,
|
42 |
inputs=["text", "state"],
|
43 |
outputs=["chatbot", "state"],
|
44 |
+
title="Tu Compañero AI con DistilGPT-2",
|
45 |
+
description="Un chatbot de IA utilizando el modelo DistilGPT-2 para conversaciones simples.",
|
46 |
)
|
47 |
|
48 |
iface.launch()
|