andyfe commited on
Commit
5d80cfa
·
1 Parent(s): 47c4494

Update app.py

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