Update app.py
Browse files
app.py
CHANGED
@@ -63,9 +63,12 @@ def generate_response(prompt: str) -> str:
|
|
63 |
top_k=40,
|
64 |
repetition_penalty=1.1
|
65 |
)
|
66 |
-
|
|
|
|
|
|
|
67 |
|
68 |
-
return {"user": prompt, "assistant":
|
69 |
|
70 |
|
71 |
def generate_prompt_response(persona_prompt: str, prompt: str) -> dict:
|
@@ -91,7 +94,7 @@ def generate_prompt_response(persona_prompt: str, prompt: str) -> dict:
|
|
91 |
)
|
92 |
generated_text = pipe(persona_prompt + user_prompt)[0]['generated_text']
|
93 |
|
94 |
-
|
95 |
assistant_response = generated_text.replace("ASSISTANT:", "").strip()
|
96 |
|
97 |
# Return the user prompt and assistant's response as a dictionary
|
|
|
63 |
top_k=40,
|
64 |
repetition_penalty=1.1
|
65 |
)
|
66 |
+
generated_text = pipe(persona_prompt + user_prompt)[0]['generated_text']
|
67 |
+
|
68 |
+
# Remove the "ASSISTANT:" prefix from the generated text
|
69 |
+
assistant_response = generated_text.replace("ASSISTANT:", "").strip()
|
70 |
|
71 |
+
return {"user": prompt, "assistant": assistant_response}
|
72 |
|
73 |
|
74 |
def generate_prompt_response(persona_prompt: str, prompt: str) -> dict:
|
|
|
94 |
)
|
95 |
generated_text = pipe(persona_prompt + user_prompt)[0]['generated_text']
|
96 |
|
97 |
+
# Remove the "ASSISTANT:" prefix from the generated text
|
98 |
assistant_response = generated_text.replace("ASSISTANT:", "").strip()
|
99 |
|
100 |
# Return the user prompt and assistant's response as a dictionary
|