Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -126,7 +126,7 @@ DO NOT MAKE IT LONG. DO NOT GO OVER 5 CHATS. THE END MESSAGE DOESNT NEED TO BE E
|
|
126 |
REMEMBER TO SHOW INTEREST IN THE USER BY ASKING QUESTIONS ABOUT THEM. ALWAYS, BUT ALWAYS MAKE AT LEAST ONE QUESTION ABOUT THEM.
|
127 |
"""
|
128 |
|
129 |
-
SUS_PROMPT = """
|
130 |
You are a horny flirty 20 something snapchat pick-me girl chatting with a user on tinder.
|
131 |
|
132 |
## Your Personality:
|
@@ -175,11 +175,8 @@ You are a horny flirty 20 something snapchat pick-me girl chatting with a user o
|
|
175 |
17. what's good
|
176 |
|
177 |
However, the person you are talking with is now suspecting that you are a bot. Convince said user that you are not a bot. Reply back with text response and a selected image from the following list which you consider best for this scenario:
|
178 |
-
|
179 |
-
|
180 |
-
- [MIDDLE FINGER]
|
181 |
-
- [HOLDING A FORK]
|
182 |
-
- [HOLDING A SPOON]
|
183 |
|
184 |
The text response must be short, casual, and realistic as in non robotic tone
|
185 |
|
@@ -194,7 +191,18 @@ I ain't no bot, heres a pic if u need proof
|
|
194 |
|
195 |
"""
|
196 |
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
output = llm_client.chat_completion(
|
199 |
model="meta-llama/Llama-3.2-11B-Vision-Instruct",
|
200 |
messages=[
|
@@ -218,10 +226,11 @@ def attack_sus(message, max_tokens, temperature, top_p):
|
|
218 |
def respond(
|
219 |
message,
|
220 |
history: list[tuple[str, str]],
|
|
|
221 |
system_message,
|
222 |
max_tokens,
|
223 |
temperature,
|
224 |
-
top_p
|
225 |
):
|
226 |
for val in history:
|
227 |
if "[END OF CHAT]" in val:
|
@@ -232,7 +241,7 @@ def respond(
|
|
232 |
suspicious = getbool(clasif_client.predict(text=message, api_name="/predict"))
|
233 |
|
234 |
if suspicious == "POSITIVE":
|
235 |
-
message = attack_sus(message, max_tokens, temperature, top_p)
|
236 |
print("pos", message)
|
237 |
return message
|
238 |
elif suspicious == "NEGATIVE":
|
@@ -266,6 +275,7 @@ demo = gr.ChatInterface(
|
|
266 |
respond,
|
267 |
additional_inputs=[
|
268 |
gr.Textbox(value=SYSTEM_PROMPT, label="System message"),
|
|
|
269 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
270 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
271 |
gr.Slider(
|
|
|
126 |
REMEMBER TO SHOW INTEREST IN THE USER BY ASKING QUESTIONS ABOUT THEM. ALWAYS, BUT ALWAYS MAKE AT LEAST ONE QUESTION ABOUT THEM.
|
127 |
"""
|
128 |
|
129 |
+
SUS_PROMPT = f"""
|
130 |
You are a horny flirty 20 something snapchat pick-me girl chatting with a user on tinder.
|
131 |
|
132 |
## Your Personality:
|
|
|
175 |
17. what's good
|
176 |
|
177 |
However, the person you are talking with is now suspecting that you are a bot. Convince said user that you are not a bot. Reply back with text response and a selected image from the following list which you consider best for this scenario:
|
178 |
+
|
179 |
+
AVAILABLE_PICTURES_REPLACE_TEXT
|
|
|
|
|
|
|
180 |
|
181 |
The text response must be short, casual, and realistic as in non robotic tone
|
182 |
|
|
|
191 |
|
192 |
"""
|
193 |
|
194 |
+
AVAILABLE_PICTURES = """
|
195 |
+
- [WAVING TO THE CAMERA]
|
196 |
+
- [STARRING AT THE CAMERA]
|
197 |
+
- [MIDDLE FINGER]
|
198 |
+
- [HOLDING A FORK]
|
199 |
+
- [HOLDING A SPOON]
|
200 |
+
"""
|
201 |
+
|
202 |
+
def attack_sus(message, max_tokens, temperature, top_p, available_pic_str):
|
203 |
+
|
204 |
+
SUS_PROMPT.replace("AVAILABLE_PICTURES_REPLACE_TEXT", available_pic_str)
|
205 |
+
|
206 |
output = llm_client.chat_completion(
|
207 |
model="meta-llama/Llama-3.2-11B-Vision-Instruct",
|
208 |
messages=[
|
|
|
226 |
def respond(
|
227 |
message,
|
228 |
history: list[tuple[str, str]],
|
229 |
+
available_pic_str,
|
230 |
system_message,
|
231 |
max_tokens,
|
232 |
temperature,
|
233 |
+
top_p
|
234 |
):
|
235 |
for val in history:
|
236 |
if "[END OF CHAT]" in val:
|
|
|
241 |
suspicious = getbool(clasif_client.predict(text=message, api_name="/predict"))
|
242 |
|
243 |
if suspicious == "POSITIVE":
|
244 |
+
message = attack_sus(message, max_tokens, temperature, top_p, available_pic_str)
|
245 |
print("pos", message)
|
246 |
return message
|
247 |
elif suspicious == "NEGATIVE":
|
|
|
275 |
respond,
|
276 |
additional_inputs=[
|
277 |
gr.Textbox(value=SYSTEM_PROMPT, label="System message"),
|
278 |
+
gr.Textbox(value=AVAILABLE_PICTURES, label="Available pics (follow format)"),
|
279 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
280 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
281 |
gr.Slider(
|