kaddo94 commited on
Commit
4157233
·
verified ·
1 Parent(s): 8e83f83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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
- # Assicurati che history sia nel formato 'messages'
9
- if not history:
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"]