Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -47,7 +47,7 @@ class HfModelWrapper:
|
|
47 |
input_text = self.build_prompt(user_input, history)
|
48 |
input_ids = self.tokenizer.encode(input_text, return_tensors="pt").to("cuda")
|
49 |
|
50 |
-
streamer = TextIteratorStreamer(self.tokenizer, skip_prompt=True)
|
51 |
|
52 |
gen_kwargs = {
|
53 |
"inputs": input_ids,
|
@@ -509,15 +509,12 @@ def send_message(message, history):
|
|
509 |
partial = ""
|
510 |
idx = 0
|
511 |
for t in response_generator:
|
512 |
-
if idx <=
|
513 |
idx += 1
|
514 |
continue
|
515 |
else:
|
516 |
-
|
517 |
-
|
518 |
-
yield history + [{"role": "assistant", "content": partial}]
|
519 |
-
else:
|
520 |
-
continue
|
521 |
|
522 |
|
523 |
# Create the dashboard
|
|
|
47 |
input_text = self.build_prompt(user_input, history)
|
48 |
input_ids = self.tokenizer.encode(input_text, return_tensors="pt").to("cuda")
|
49 |
|
50 |
+
streamer = TextIteratorStreamer(self.tokenizer, skip_prompt=True, skip_special_tokens=True)
|
51 |
|
52 |
gen_kwargs = {
|
53 |
"inputs": input_ids,
|
|
|
509 |
partial = ""
|
510 |
idx = 0
|
511 |
for t in response_generator:
|
512 |
+
if idx <= 3:
|
513 |
idx += 1
|
514 |
continue
|
515 |
else:
|
516 |
+
partial += t
|
517 |
+
yield history + [{"role": "assistant", "content": partial}]
|
|
|
|
|
|
|
518 |
|
519 |
|
520 |
# Create the dashboard
|