chat_bot / app.py
Itxmosii's picture
Update app.py
c1247cb verified
import streamlit as st
# Emergency responses based on the type of emergency
emergency_responses = {
"Heart Attack": "If someone is having a heart attack, call emergency services immediately. Start CPR if trained.",
"Bleeding": "Apply pressure to the wound to stop the bleeding. If bleeding is severe, call emergency services immediately.",
"Accident": "Check for injuries. If there are any serious injuries, call emergency services. Stay calm and assess the situation.",
"Theft": "If you are in immediate danger, call emergency services. Report the theft to the authorities.",
"Abuse": "If you're experiencing abuse, seek immediate help from emergency services or a trusted person.",
"Fire": "Leave the building immediately and call the fire department. If you're unable to exit, stay low to avoid smoke inhalation."
}
# Streamlit UI setup
st.title("AI-Powered Emergency Help Bot")
st.sidebar.header("Location Info")
location = st.sidebar.text_input("Enter your location (city, country)", "")
st.sidebar.header("Emergency Type")
emergency_type = st.sidebar.selectbox("Select the emergency type", list(emergency_responses.keys()))
user_input = st.text_input("Describe your emergency or ask for help:")
# Show emergency response based on type
if user_input:
if location:
response = emergency_responses.get(emergency_type, "Sorry, we couldn't find specific help for this emergency.")
st.write(f"Location: {location}")
st.write(f"Emergency Type: {emergency_type}")
st.write(f"Response: {response}")
else:
st.warning("Please enter your location to get emergency resources.")
else:
st.warning("Please describe your emergency.")