Update app.py
Browse files75 unmodified lines7677787979808182838485868788858990919293949596979816 unmodified lines11511611711011875 unmodified lines with st.spinner("Generating response..."): # Prepare the payload for the API payload = { "inputs": f"{system_message}\n{prompt}", "inputs": { "past_user_inputs": [msg["content"] for msg in st.session_state.messages if msg["role"] == "user"], "generated_responses": [msg["content"] for msg in st.session_state.messages if msg["role"] == "assistant"], "text": prompt }, "parameters": { "max_new_tokens": max_tokens, "temperature": temperature, "top_p": top_p, "return_full_text": False } }, "system_prompt": system_message }
# Log the full message parsed to the API logger.info(f"Full message sent to API: {payload}")
# Dynamically construct the API URL based on the selected model api_url = f"https://api-inference.huggingface.co/models/{selected_model}" logger.info(f"Selected model: {selected_model}, API URL: {api_url}")16 unmodified lines
except Exception as e: logger.error(f"Application Error: {str(e)}", exc_info=True) st.error(f"Application Error: {str(e)}") st.error(f"Application Error: {str(e)}")app.py+11-3