Spaces:
Sleeping
Sleeping
robert
commited on
Commit
•
c88df11
1
Parent(s):
c42ac02
Refactoring the model to be a function not a generator
Browse files
app.py
CHANGED
@@ -77,10 +77,14 @@ def spaces_model_predict(message: str, history: list[tuple[str, str]]):
|
|
77 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
78 |
t.start()
|
79 |
|
80 |
-
|
81 |
for new_token in streamer:
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
84 |
|
85 |
|
86 |
def predict(
|
|
|
77 |
t = Thread(target=model.generate, kwargs=generate_kwargs)
|
78 |
t.start()
|
79 |
|
80 |
+
generated_text = ""
|
81 |
for new_token in streamer:
|
82 |
+
generated_text += new_token
|
83 |
+
if "<|user|>" in generated_text:
|
84 |
+
generated_text = generated_text.split("<|user|>")[0].strip()
|
85 |
+
break
|
86 |
+
|
87 |
+
return generated_text
|
88 |
|
89 |
|
90 |
def predict(
|