Spaces:
Runtime error
Runtime error
Update app.py
Browse files77 unmodified lines7879808182838485868788899091929394959638 unmodified lines13513613713813914014144 unmodified lines18618718818919019119277 unmodified lines# Configure system messagesystem_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."""def generate_response(user_input, chat_history):try:logger.info("Generating response for user input...")global total_water_consumption# Calculate water consumption for inputinput_water_consumption = calculate_water_consumption(user_input, True)total_water_consumption += input_water_consumption# Create prompt following Llama 2 chat formatconversation = f""<s>[INST] {system_message}# Constants for water consumption calculationWATER_PER_TOKEN = {"input_training": 0.0000309,38 unmodified linesfor message in chat_history:conversation_history += f"[INST] {message[0]} [/INST] {message[1]} "prompt = f"{system_message}\n\n{conversation_history}[INST] {user_input} [/INST]"logger.info("Generating model response...")outputs = model_gen(44 unmodified lines<div style="text-align: center; max-width: 800px; margin: 0 auto; padding: 20px;"><h1 style="color: #2d333a;">AQuaBot</h1><p style="color: #4a5568;">Welcome to AQuaBot - An AI assistant powered by Llama 2 that helps raise awarenessabout water consumption in language models.</p></div>77 unmodified lines78798081828338 unmodified lines12212312412512612712844 unmodified lines17317417517617717817977 unmodified lines# Configure system messagesystem_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."""# Constants for water consumption calculationWATER_PER_TOKEN = {"input_training": 0.0000309,38 unmodified linesfor message in chat_history:conversation_history += f"[INST] {message[0]} [/INST] {message[1]} "prompt = f"<s>[INST] {system_message}\n\n{conversation_history}[INST] {user_input} [/INST]"logger.info("Generating model response...")outputs = model_gen(44 unmodified lines<div style="text-align: center; max-width: 800px; margin: 0 auto; padding: 20px;"><h1 style="color: #2d333a;">AQuaBot</h1><p style="color: #4a5568;">Welcome to AQuaBot - An AI assistant that helps raise awarenessabout water consumption in language models.</p></div>
app.py+2-15