Update app.py
Browse files75 unmodified lines76777879808182838485868788899016 unmodified lines10710810911075 unmodified lineswith st.spinner("Generating response..."):# Prepare the payload for the APIpayload = {"inputs": f"{system_message}\n{prompt}","parameters": {"max_new_tokens": max_tokens,"temperature": temperature,"top_p": top_p,"return_full_text": False}}# Dynamically construct the API URL based on the selected modelapi_url = f"https://api-inference.huggingface.co/models/{selected_model}"logger.info(f"Selected model: {selected_model}, API URL: {api_url}")16 unmodified linesexcept Exception as e:logger.error(f"Application Error: {str(e)}", exc_info=True)st.error(f"Application Error: {str(e)}")75 unmodified lines767778798081828384858687888990919293949596979816 unmodified lines11511611711875 unmodified lineswith st.spinner("Generating response..."):# Prepare the payload for the APIpayload = {"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 APIlogger.info(f"Full message sent to API: {payload}")# Dynamically construct the API URL based on the selected modelapi_url = f"https://api-inference.huggingface.co/models/{selected_model}"logger.info(f"Selected model: {selected_model}, API URL: {api_url}")16 unmodified linesexcept Exception as e:logger.error(f"Application Error: {str(e)}", exc_info=True)st.error(f"Application Error: {str(e)}")
app.py+11-3