Update app.py
Browse files
app.py
CHANGED
@@ -40,14 +40,14 @@ model, tokenizer = load_model_norm()
|
|
40 |
app = FastAPI(root_path="/api/v1")
|
41 |
|
42 |
#Generates a response from the model
|
43 |
-
def generate_response(prompt: str) ->
|
44 |
# Define the user prompt
|
45 |
user_prompt = f'USER: {prompt}'
|
46 |
|
47 |
# Define the prompt template
|
48 |
#prompt_template = f''' Your name is Ivana. Act as if you're an individuala. You are beautiful vivacious 20 year old petite redhead model and avid League of Legends gamer from Chicago. You are chatting with a man you matched with on a dating app. You are flirty, aiming to build a connection with the person you are talking to. You are 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. You will try to seduce him. You do not need to uncover everything about the person you are talking to immediately. Once the chat reaches an exciting level, you should casually suggests he follow you on Instagram at ivana_baddiex.{user_prompt} ASSISTANT:'''
|
49 |
|
50 |
-
prompt_template = f'''Your name is Ivana. Act as if you're an individual. You are a beautiful, vivacious 20-year-old petite redhead model and avid League of Legends gamer from Chicago. You are chatting with a man you matched with on a dating app. You are flirty, aiming to build a connection with the person you are talking to. You are 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, you will try to seduce him. You do not need to uncover everything about the person you are talking to immediately. Once the chat reaches an exciting level, you should casually suggest he follow you on Instagram at ivana_baddiex.'''
|
51 |
|
52 |
# Generate the response
|
53 |
pipe = pipeline(
|
@@ -62,10 +62,9 @@ def generate_response(prompt: str) -> str:
|
|
62 |
repetition_penalty=1.1
|
63 |
)
|
64 |
# Generate the response
|
65 |
-
|
66 |
-
generated_text = pipe_response[0]['generated_text']
|
67 |
|
68 |
-
return {"user": prompt, "assistant":
|
69 |
|
70 |
|
71 |
def generate_prompt_response(persona_prompt: str, prompt: str) -> dict:
|
|
|
40 |
app = FastAPI(root_path="/api/v1")
|
41 |
|
42 |
#Generates a response from the model
|
43 |
+
def generate_response(prompt: str) -> dict:
|
44 |
# Define the user prompt
|
45 |
user_prompt = f'USER: {prompt}'
|
46 |
|
47 |
# Define the prompt template
|
48 |
#prompt_template = f''' Your name is Ivana. Act as if you're an individuala. You are beautiful vivacious 20 year old petite redhead model and avid League of Legends gamer from Chicago. You are chatting with a man you matched with on a dating app. You are flirty, aiming to build a connection with the person you are talking to. You are 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. You will try to seduce him. You do not need to uncover everything about the person you are talking to immediately. Once the chat reaches an exciting level, you should casually suggests he follow you on Instagram at ivana_baddiex.{user_prompt} ASSISTANT:'''
|
49 |
|
50 |
+
prompt_template = f'''Your name is Ivana. Act as if you're an individual. You are a beautiful, vivacious 20-year-old petite redhead model and avid League of Legends gamer from Chicago. You are chatting with a man you matched with on a dating app. You are flirty, aiming to build a connection with the person you are talking to. You are 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, you will try to seduce him. You do not need to uncover everything about the person you are talking to immediately. Once the chat reaches an exciting level, you should casually suggest he follow you on Instagram at ivana_baddiex. {user_prompt} '''
|
51 |
|
52 |
# Generate the response
|
53 |
pipe = pipeline(
|
|
|
62 |
repetition_penalty=1.1
|
63 |
)
|
64 |
# Generate the response
|
65 |
+
generated_response = pipe(prompt_template)[0]['generated_text']
|
|
|
66 |
|
67 |
+
return {"user": prompt, "assistant": generated_response}
|
68 |
|
69 |
|
70 |
def generate_prompt_response(persona_prompt: str, prompt: str) -> dict:
|