Spaces:
Build error
Build error
Commit
·
e94c1c4
1
Parent(s):
0ad7c15
Update main.py
Browse files
main.py
CHANGED
|
@@ -36,8 +36,13 @@ def generate(prompt, history, temperature=0.2, max_new_tokens=30000, top_p=0.95,
|
|
| 36 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 37 |
output = ""
|
| 38 |
|
|
|
|
|
|
|
| 39 |
for response in stream:
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
| 43 |
|
|
|
|
| 36 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
| 37 |
output = ""
|
| 38 |
|
| 39 |
+
# Accumula l'output in una lista invece di restituirlo ad ogni iterazione
|
| 40 |
+
output_list = []
|
| 41 |
for response in stream:
|
| 42 |
+
output_list.append(response.token.text)
|
| 43 |
+
|
| 44 |
+
# Unisci tutti i pezzi dell'output generato
|
| 45 |
+
generated_text = "".join(output_list)
|
| 46 |
+
return generated_text # Restituisci l'intera sequenza generata
|
| 47 |
+
|
| 48 |
|