Spaces:
Build error
Build error
Merge pull request #4 from jakewatson91/jake/tests_fixes
Browse files
app.py
CHANGED
|
@@ -10,14 +10,14 @@ pipe = pipeline("text-generation", "microsoft/Phi-3-mini-4k-instruct", torch_dty
|
|
| 10 |
# Global flag to handle cancellation
|
| 11 |
stop_inference = False
|
| 12 |
|
| 13 |
-
|
| 14 |
Provide no advice, commentary, or additional context.\
|
| 15 |
Your responses should be concise, no more than 3 quotes, and consist only of famous motivational quotes."
|
| 16 |
|
| 17 |
def respond(
|
| 18 |
message,
|
| 19 |
history: list[tuple[str, str]],
|
| 20 |
-
system_message=
|
| 21 |
max_tokens=512,
|
| 22 |
temperature=0.7,
|
| 23 |
top_p=0.95,
|
|
@@ -30,10 +30,10 @@ def respond(
|
|
| 30 |
# Modify system message or prompt based on practicality
|
| 31 |
if practicality > 0.5:
|
| 32 |
# More practical response
|
| 33 |
-
system_message =
|
| 34 |
else:
|
| 35 |
# More theoretical response
|
| 36 |
-
system_message =
|
| 37 |
|
| 38 |
# Initialize history if it's None
|
| 39 |
if history is None:
|
|
|
|
| 10 |
# Global flag to handle cancellation
|
| 11 |
stop_inference = False
|
| 12 |
|
| 13 |
+
base_system_message = "You are a chatbot that responds with famous quotes from books, movies, philsophers, and business leaders \
|
| 14 |
Provide no advice, commentary, or additional context.\
|
| 15 |
Your responses should be concise, no more than 3 quotes, and consist only of famous motivational quotes."
|
| 16 |
|
| 17 |
def respond(
|
| 18 |
message,
|
| 19 |
history: list[tuple[str, str]],
|
| 20 |
+
system_message=base_system_message,
|
| 21 |
max_tokens=512,
|
| 22 |
temperature=0.7,
|
| 23 |
top_p=0.95,
|
|
|
|
| 30 |
# Modify system message or prompt based on practicality
|
| 31 |
if practicality > 0.5:
|
| 32 |
# More practical response
|
| 33 |
+
system_message = base_system_message + "Provide actionable advice or direct instructions."
|
| 34 |
else:
|
| 35 |
# More theoretical response
|
| 36 |
+
system_message = base_system_message + "Provide theoretical concepts or abstract quotes."
|
| 37 |
|
| 38 |
# Initialize history if it's None
|
| 39 |
if history is None:
|