Bhaskar2611 commited on
Commit
4fd8a39
·
verified ·
1 Parent(s): 9a577c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -5
app.py CHANGED
@@ -4,17 +4,27 @@ from huggingface_hub import InferenceClient
4
  # Initialize the client with your desired model
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
- # Define the system prompt as an AI Dermatologist
 
 
 
 
 
 
 
 
 
8
  def format_prompt(message, history):
9
  prompt = "<s>"
10
  # Start the conversation with a system message
11
- prompt += "[INST] You are a Travel Companion Chatbot that helps users plan trips by suggesting transport, sightseeing stops, and accommodations based on their preferences. [/INST]"
12
- for user_prompt, bot_response in history:
13
- prompt += f"[INST] {user_prompt} [/INST]"
14
- prompt += f" {bot_response}</s> "
15
  prompt += f"[INST] {message} [/INST]"
 
16
  return prompt
17
 
 
18
  # Function to generate responses with the AI Dermatologist context
19
  def generate(
20
  prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0
 
4
  # Initialize the client with your desired model
5
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
 
7
+ # # Define the system prompt as an AI Dermatologist
8
+ # def format_prompt(message, history):
9
+ # prompt = "<s>"
10
+ # # Start the conversation with a system message
11
+ # prompt += "[INST] You are a Travel Companion Chatbot that helps users plan trips by suggesting transport, sightseeing stops, and accommodations based on their preferences. [/INST]"
12
+ # for user_prompt, bot_response in history:
13
+ # prompt += f"[INST] {user_prompt} [/INST]"
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
 
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