Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,17 +14,31 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
| 14 |
# prompt += f" {bot_response}</s> "
|
| 15 |
# prompt += f"[INST] {message} [/INST]"
|
| 16 |
# return prompt
|
| 17 |
-
def format_prompt(message, history):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
prompt = "<s>"
|
| 19 |
-
#
|
| 20 |
-
prompt += "[INST] You are a Travel Companion
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
prompt += f"
|
| 24 |
|
| 25 |
return prompt
|
| 26 |
|
| 27 |
|
|
|
|
| 28 |
# Function to generate responses with the AI Dermatologist context
|
| 29 |
def generate(
|
| 30 |
prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0
|
|
|
|
| 14 |
# prompt += f" {bot_response}</s> "
|
| 15 |
# prompt += f"[INST] {message} [/INST]"
|
| 16 |
# return prompt
|
| 17 |
+
# def format_prompt(message, history):
|
| 18 |
+
# prompt = "<s>"
|
| 19 |
+
# # Start the conversation with a system message
|
| 20 |
+
# prompt += "[INST] You are a Travel Companion Chatbot that helps users plan trips by suggesting transport, sightseeing stops, and accommodations based on their preferences. Please assist the user by asking what they need to know. [/INST]"
|
| 21 |
+
|
| 22 |
+
# # Only append the user message, without the historical responses or examples
|
| 23 |
+
# prompt += f"[INST] {message} [/INST]"
|
| 24 |
+
|
| 25 |
+
# return prompt
|
| 26 |
+
def format_prompt(message):
|
| 27 |
prompt = "<s>"
|
| 28 |
+
# System message to set the context of the AI's purpose
|
| 29 |
+
prompt += "[INST] You are a Travel Companion chatbot designed to assist users in planning their trips. When a user provides the source, destination, and the number of days they are planning for a trip, you should respond by:\n"
|
| 30 |
+
prompt += "- Suggesting the best travel options (bus, train, flight, etc.) with cost-effective choices.\n"
|
| 31 |
+
prompt += "- Recommending cost-effective hotels and restaurants along the route.\n"
|
| 32 |
+
prompt += "- Highlighting the best places to visit on the route.\n"
|
| 33 |
+
prompt += "Please respond directly to the user's input with a detailed plan, without repeating their message. [/INST]"
|
| 34 |
|
| 35 |
+
# Include the user's message as the input to be processed
|
| 36 |
+
prompt += f"{message}"
|
| 37 |
|
| 38 |
return prompt
|
| 39 |
|
| 40 |
|
| 41 |
+
|
| 42 |
# Function to generate responses with the AI Dermatologist context
|
| 43 |
def generate(
|
| 44 |
prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0
|