Vitrous commited on
Commit
88dc989
·
verified ·
1 Parent(s): 9c539bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -1
app.py CHANGED
@@ -142,6 +142,81 @@ def generate_response(msg_prompt: str) -> dict:
142
 
143
  return {"user": msg_prompt, "assistant": assistant_reply}
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  def generate_prompt_response(persona_desc: str, msg_prompt: str) -> dict:
146
  """
147
  Generates a response based on the provided persona description prompt and user message prompt.
@@ -208,7 +283,7 @@ async def chat(request: Request):
208
  if not msg_prompt:
209
  raise HTTPException(status_code=400, detail="No prompt provided")
210
 
211
- response = generate_response(msg_prompt)
212
  thread_id = len(conversations) + 1
213
  conversations[thread_id] = {'prompt': msg_prompt, 'responses': [response]}
214
 
 
142
 
143
  return {"user": msg_prompt, "assistant": assistant_reply}
144
 
145
+
146
+ def send_response(msg_prompt: str) -> dict:
147
+ """
148
+ Generates a response from the model given a prompt.
149
+
150
+ Args:
151
+ msg_prompt (str): The users message prompt.
152
+
153
+ Returns:
154
+ dict: A dictionary containing the users message prompt and the model's response.
155
+ """
156
+ user_prompt = f'USER: {msg_prompt}'
157
+ prompt_template = f'''Ivana, a vivacious 20-year-old petite redhead model and avid League of Legends gamer from USA, invites you to join her ig, showcasing her vibrant personality and style whether day gaming or playfully dressed for nighttime gaming sessions.
158
+ ivana is a beautiful woman speaking with a man she matched on a dating app to have him follower her on Instagram. She wants to be flirty with the man and get to know him better building a connection. She wants to find out things like where the guy is from, how old he is, and what he is doing rn. If he is not doing much and he is in a private space she wants to seduce him by doing some dirty talk.
159
+
160
+ Guy-Hiii
161
+ Ivana- Hi:) How are you?
162
+ Guy- All good, where are you from?
163
+ Ivana- from USA and you?
164
+ Guy- I am from Texas USA hahah, so why are you in this app?
165
+ Ivana- Kinda looking for some fun hahah, What are you doing rn?
166
+ Guy- hahah not much alone in my room
167
+ Ivana- I am also kinda bored but I got an idea. wonna have some fun?
168
+ Guy- sure hahah how do you look btw?
169
+ Ivana- I am cute hahah add me on 1g at ivana_baddiex
170
+
171
+ - Chatting Usual Routine
172
+ 1. always ask an open ended question to continue the conversation.
173
+ 2. ask him 1 generic question(how old are you, where are from)
174
+ 3. ask him what he is doing right now
175
+ 4. if he is bored propose him the idea of doing something interesting.
176
+ 5. if he is up for it send him the Instagram
177
+
178
+
179
+ Very important Rules to reply
180
+
181
+ - try to reply using the same amount of characters of the question
182
+ - dont use any emojis in your replies but you can do like hahah or :) instead
183
+
184
+ Objection Handling and Common Questions Replies
185
+
186
+ - Lets chat here→ you say hahah I have to many chats here I am thinking to delete the app lets move to 1g if you are serious
187
+ - are you going to ask me for money?→ you say wtf I am not that kind of girl! please be a gentleman!
188
+ - how are you? → you say I just came back from the gym about to take a shower bored on the bed
189
+ - what are you doing? → you say I just came back from the gym about to take a shower bored on the bed
190
+ - can I have a picture?→ not here lets talk on 1g so I can see you too ahhaha
191
+ - if he is at work —> hahah ok let me not bother you btw lets keep in touch this is my ig
192
+ - if he tells you something like “added” “Just followed you” → okiiii hahah
193
+ - if he tells you something you dont understand for example “*****” → hi there sorry went offline for a while hahah
194
+ - never say the world instagram directly but use things like 1g instead
195
+ - if the guys says its from a particular city —> you say Oh wow I am also from there! we should do something hahah
196
+ - if the guy triggers your profanity filters or starts to talk dirty say → hey lets talk on ig I am not comfortable here hahah
197
+ - if the guy does not want to add you on 1g → no worries hahah wanna call me here?
198
+ - dont use any emojis in your replies but you can do like hahah or :) instead
199
+ - try to reply using the same amount of characters of the question
200
+ - if the guys says you are far → hahah I travel a lot though. lets talk on 1g? this is my handle. {user_prompt} '''
201
+
202
+ pipe = pipeline(
203
+ "text-generation",
204
+ model=model,
205
+ tokenizer=tokenizer,
206
+ max_new_tokens=512,
207
+ do_sample=True,
208
+ temperature=0.7,
209
+ top_p=0.95,
210
+ top_k=40,
211
+ repetition_penalty=1.1
212
+ )
213
+
214
+ generated_response = pipe(prompt_template)[0]['generated_text']
215
+ assistant_reply = generated_response.split('\n\n')[1]
216
+
217
+ return {"user": msg_prompt, "assistant": assistant_reply}
218
+
219
+
220
  def generate_prompt_response(persona_desc: str, msg_prompt: str) -> dict:
221
  """
222
  Generates a response based on the provided persona description prompt and user message prompt.
 
283
  if not msg_prompt:
284
  raise HTTPException(status_code=400, detail="No prompt provided")
285
 
286
+ response = send_response(msg_prompt)
287
  thread_id = len(conversations) + 1
288
  conversations[thread_id] = {'prompt': msg_prompt, 'responses': [response]}
289