ChavinloSocialRise commited on
Commit
8d73370
·
verified ·
1 Parent(s): 6e5508e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -160,7 +160,7 @@ def attack_sus(message, max_tokens, temperature, top_p):
160
  top_p=top_p,
161
  )
162
 
163
- return output.choices[0].delta.content
164
 
165
  def respond(
166
  message,
@@ -176,6 +176,7 @@ def respond(
176
 
177
  if suspicious == "POSITIVE":
178
  for message in attack_sus(message, max_tokens, temperature, top_p):
 
179
  yield message
180
  elif suspicious == "NEGATIVE":
181
  messages = [{"role": "system", "content": system_message}]
@@ -192,9 +193,10 @@ def respond(
192
  messages,
193
  model="meta-llama/Llama-3.2-11B-Vision-Instruct",
194
  max_tokens=max_tokens,
195
- stream=True,
196
  temperature=temperature,
197
  top_p=top_p):
 
198
  yield message
199
  else:
200
  raise Exception(f"Invalid suspicious type:{suspicious}")
 
160
  top_p=top_p,
161
  )
162
 
163
+ return output
164
 
165
  def respond(
166
  message,
 
176
 
177
  if suspicious == "POSITIVE":
178
  for message in attack_sus(message, max_tokens, temperature, top_p):
179
+ print("pos", message)
180
  yield message
181
  elif suspicious == "NEGATIVE":
182
  messages = [{"role": "system", "content": system_message}]
 
193
  messages,
194
  model="meta-llama/Llama-3.2-11B-Vision-Instruct",
195
  max_tokens=max_tokens,
196
+ stream=False,
197
  temperature=temperature,
198
  top_p=top_p):
199
+ print("neg: ", message)
200
  yield message
201
  else:
202
  raise Exception(f"Invalid suspicious type:{suspicious}")