Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -81,6 +81,9 @@ def generate(
|
|
| 81 |
top_k: int = 20,
|
| 82 |
repetition_penalty: float = 1.0,
|
| 83 |
) -> Iterator[str]:
|
|
|
|
|
|
|
|
|
|
| 84 |
conversation = []
|
| 85 |
if model_choice == "Storytell":
|
| 86 |
model = storytell_model
|
|
@@ -88,7 +91,7 @@ def generate(
|
|
| 88 |
else:
|
| 89 |
model = editing_model
|
| 90 |
tokenizer = editing_tokenizer
|
| 91 |
-
|
| 92 |
# Checking each tuple in chat_history to ensure it has exactly two elements
|
| 93 |
for item in chat_history:
|
| 94 |
if isinstance(item, tuple) and len(item) == 2:
|
|
|
|
| 81 |
top_k: int = 20,
|
| 82 |
repetition_penalty: float = 1.0,
|
| 83 |
) -> Iterator[str]:
|
| 84 |
+
if chat_history is None:
|
| 85 |
+
chat_history = []
|
| 86 |
+
|
| 87 |
conversation = []
|
| 88 |
if model_choice == "Storytell":
|
| 89 |
model = storytell_model
|
|
|
|
| 91 |
else:
|
| 92 |
model = editing_model
|
| 93 |
tokenizer = editing_tokenizer
|
| 94 |
+
|
| 95 |
# Checking each tuple in chat_history to ensure it has exactly two elements
|
| 96 |
for item in chat_history:
|
| 97 |
if isinstance(item, tuple) and len(item) == 2:
|