Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -159,20 +159,19 @@ def query(system_prompt, user_prompt, temperature=0.9, max_new_tokens=256, top_p
|
|
159 |
prompt = f"System: {system_prompt}\nUser: {user_prompt}\n"
|
160 |
print(prompt)
|
161 |
print('-----')
|
162 |
-
output = client.text_generation(prompt, **generate_kwargs, details=True, return_full_text=False)
|
163 |
-
print(output)
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
# yield output
|
176 |
return output
|
177 |
|
178 |
iface = gr.Interface(
|
|
|
159 |
prompt = f"System: {system_prompt}\nUser: {user_prompt}\n"
|
160 |
print(prompt)
|
161 |
print('-----')
|
162 |
+
#output = client.text_generation(prompt, **generate_kwargs, details=True, return_full_text=False)
|
163 |
+
#print(output)
|
164 |
+
stream = client.text_generation(prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
165 |
+
output = ""
|
166 |
+
for response in stream:
|
167 |
+
output += response.token.text
|
168 |
+
|
169 |
+
for stop_str in STOP_SEQUENCES:
|
170 |
+
if output.endswith(stop_str):
|
171 |
+
output = output[:-len(stop_str)]
|
172 |
+
output = output.rstrip()
|
173 |
+
#yield output
|
174 |
+
#yield output
|
|
|
175 |
return output
|
176 |
|
177 |
iface = gr.Interface(
|