Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ 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, device_map="auto", load_in_8bit=True)
|
9 |
|
@@ -26,7 +26,7 @@ def generate_response(prompt, max_length=200):
|
|
26 |
def chatbot(message, history):
|
27 |
history = history or []
|
28 |
|
29 |
-
# Construir el prompt en el formato que
|
30 |
prompt = "Eres un asistente AI amigable y útil. Responde de manera concisa y coherente.\n\n"
|
31 |
for human, ai in history:
|
32 |
prompt += f"Human: {human}\nAssistant: {ai}\n"
|
@@ -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 avanzado utilizando el modelo
|
46 |
)
|
47 |
|
48 |
iface.launch()
|
|
|
3 |
import torch
|
4 |
|
5 |
# Cargar el modelo y el tokenizador
|
6 |
+
model_name = "meta-llama/Llama-2-7b-chat-hf"
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_8bit=True)
|
9 |
|
|
|
26 |
def chatbot(message, history):
|
27 |
history = history or []
|
28 |
|
29 |
+
# Construir el prompt en el formato que Llama-2 espera
|
30 |
prompt = "Eres un asistente AI amigable y útil. Responde de manera concisa y coherente.\n\n"
|
31 |
for human, ai in history:
|
32 |
prompt += f"Human: {human}\nAssistant: {ai}\n"
|
|
|
41 |
fn=chatbot,
|
42 |
inputs=["text", "state"],
|
43 |
outputs=["chatbot", "state"],
|
44 |
+
title="Tu Compañero AI con Llama-2",
|
45 |
+
description="Un chatbot de IA avanzado utilizando el modelo Llama-2-7b-chat para conversaciones coherentes y naturales.",
|
46 |
)
|
47 |
|
48 |
iface.launch()
|