Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -111,16 +111,16 @@ def generate_response(instruction, model_path, progress=gr.Progress()):
|
|
111 |
do_sample=True
|
112 |
)
|
113 |
|
114 |
-
|
115 |
|
116 |
-
|
117 |
|
118 |
-
|
119 |
-
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
|
125 |
|
126 |
|
|
|
111 |
do_sample=True
|
112 |
)
|
113 |
|
114 |
+
full_response = response_tokenizer.decode(output[0], skip_special_tokens=True)
|
115 |
|
116 |
+
clean_response = full_response.replace(f"<|user|>\n{instruction}\n<|assistant|>", "").strip()
|
117 |
|
118 |
+
if "<|user|>" in clean_response:
|
119 |
+
clean_response = clean_response.split("<|user|>")[0].strip()
|
120 |
|
121 |
+
for token in ["<user>", "User:", "Human:"]:
|
122 |
+
if token in clean_response:
|
123 |
+
clean_response = clean_response.split(token)[0].strip()
|
124 |
|
125 |
|
126 |
|