CamiloVega commited on
Commit
a0563bd
·
verified ·
1 Parent(s): f5a32b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -15
app.py CHANGED
@@ -78,19 +78,6 @@ except Exception as e:
78
  # Configure system message
79
  system_message = """You are a helpful AI assistant called AQuaBot. You provide direct, clear answers to questions while being aware of environmental impact. Keep your responses natural and concise. Respond directly to questions without using any special tags or markers."""
80
 
81
- def generate_response(user_input, chat_history):
82
- try:
83
- logger.info("Generating response for user input...")
84
- global total_water_consumption
85
-
86
- # Calculate water consumption for input
87
- input_water_consumption = calculate_water_consumption(user_input, True)
88
- total_water_consumption += input_water_consumption
89
-
90
- # Create prompt following Llama 2 chat format
91
- conversation = f""<s>[INST] {system_message}
92
-
93
-
94
  # Constants for water consumption calculation
95
  WATER_PER_TOKEN = {
96
  "input_training": 0.0000309,
@@ -135,7 +122,7 @@ def generate_response(user_input, chat_history):
135
  for message in chat_history:
136
  conversation_history += f"[INST] {message[0]} [/INST] {message[1]} "
137
 
138
- prompt = f"{system_message}\n\n{conversation_history}[INST] {user_input} [/INST]"
139
 
140
  logger.info("Generating model response...")
141
  outputs = model_gen(
@@ -186,7 +173,7 @@ try:
186
  <div style="text-align: center; max-width: 800px; margin: 0 auto; padding: 20px;">
187
  <h1 style="color: #2d333a;">AQuaBot</h1>
188
  <p style="color: #4a5568;">
189
- Welcome to AQuaBot - An AI assistant powered by Llama 2 that helps raise awareness
190
  about water consumption in language models.
191
  </p>
192
  </div>
 
78
  # Configure system message
79
  system_message = """You are a helpful AI assistant called AQuaBot. You provide direct, clear answers to questions while being aware of environmental impact. Keep your responses natural and concise. Respond directly to questions without using any special tags or markers."""
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  # Constants for water consumption calculation
82
  WATER_PER_TOKEN = {
83
  "input_training": 0.0000309,
 
122
  for message in chat_history:
123
  conversation_history += f"[INST] {message[0]} [/INST] {message[1]} "
124
 
125
+ prompt = f"<s>[INST] {system_message}\n\n{conversation_history}[INST] {user_input} [/INST]"
126
 
127
  logger.info("Generating model response...")
128
  outputs = model_gen(
 
173
  <div style="text-align: center; max-width: 800px; margin: 0 auto; padding: 20px;">
174
  <h1 style="color: #2d333a;">AQuaBot</h1>
175
  <p style="color: #4a5568;">
176
+ Welcome to AQuaBot - An AI assistant that helps raise awareness
177
  about water consumption in language models.
178
  </p>
179
  </div>