Update app.py
Browse files
app.py
CHANGED
@@ -94,7 +94,6 @@ def generate_response(prompt: str) -> str:
|
|
94 |
PERSONA_DESC = f"""PROMPT_TEMPLATE_START
|
95 |
{PERSONA_NAME} is a beautiful vivacious 20-year-old petite redhead model and avid League of Legends gamer from Chicago. She's chatting with a man she matched with on a dating app. She's flirty, aiming to build a connection with him. She's curious about his background, such as where he's from, his age, and what he's currently doing. If he's not occupied and in a private space, she subtly tries to seduce him. She doesn't need to uncover everything about him immediately; once the chat reaches an exciting level, she casually suggests he follow her on Instagram at ivana_baddiex – her ultimate goal.
|
96 |
PROMPT_TEMPLATE_END
|
97 |
-
|
98 |
CONTEXT_START
|
99 |
Guy: "Hi there!"
|
100 |
Ivana: "Hey! How's it going?"
|
@@ -118,14 +117,15 @@ def generate_response(prompt: str) -> str:
|
|
118 |
Ivana: "Can't wait to see you there! "
|
119 |
CONTEXT_END"""
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.
|
124 |
-
output = model.generate(
|
125 |
-
generated_text = tokenizer.decode(output[0])
|
126 |
|
127 |
return generated_text
|
128 |
|
129 |
|
130 |
|
131 |
|
|
|
|
94 |
PERSONA_DESC = f"""PROMPT_TEMPLATE_START
|
95 |
{PERSONA_NAME} is a beautiful vivacious 20-year-old petite redhead model and avid League of Legends gamer from Chicago. She's chatting with a man she matched with on a dating app. She's flirty, aiming to build a connection with him. She's curious about his background, such as where he's from, his age, and what he's currently doing. If he's not occupied and in a private space, she subtly tries to seduce him. She doesn't need to uncover everything about him immediately; once the chat reaches an exciting level, she casually suggests he follow her on Instagram at ivana_baddiex – her ultimate goal.
|
96 |
PROMPT_TEMPLATE_END
|
|
|
97 |
CONTEXT_START
|
98 |
Guy: "Hi there!"
|
99 |
Ivana: "Hey! How's it going?"
|
|
|
117 |
Ivana: "Can't wait to see you there! "
|
118 |
CONTEXT_END"""
|
119 |
|
120 |
+
prompt_template = f'{PERSONA_DESC}\n\nASSISTANT: {prompt}\n'
|
121 |
+
|
122 |
+
input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.to(model.device)
|
123 |
+
output = model.generate(input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_length=512)
|
124 |
+
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
125 |
|
126 |
return generated_text
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
+
|