Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ from transformers import pipeline
|
|
5 |
generator = pipeline("text-generation", model="sshleifer/tiny-gpt2", device="cpu")
|
6 |
|
7 |
def chat_function(message, history):
|
8 |
-
#
|
9 |
-
if
|
10 |
history = []
|
11 |
# Genera la risposta
|
12 |
response = generator(message, max_length=50, num_return_sequences=1)[0]["generated_text"]
|
|
|
5 |
generator = pipeline("text-generation", model="sshleifer/tiny-gpt2", device="cpu")
|
6 |
|
7 |
def chat_function(message, history):
|
8 |
+
# Inizializza history come lista vuota se non esiste
|
9 |
+
if history is None:
|
10 |
history = []
|
11 |
# Genera la risposta
|
12 |
response = generator(message, max_length=50, num_return_sequences=1)[0]["generated_text"]
|