karthickg12 commited on
Commit
7ac2505
1 Parent(s): 6bffa01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -15
app.py CHANGED
@@ -69,25 +69,22 @@
69
  # if "bot" in message:
70
  # st.write("**Bot:**", message["bot"])
71
 
72
- import streamlit as st
73
- from rasa.shared.core.tracker_store import InMemoryTrackerStore
74
- from rasa.core.agent import Agent
75
- from rasa.shared.core.domain import Domain
76
- from rasa.shared.nlu.interpreter import RasaNLUInterpreter
77
- import streamlit as st
78
 
 
 
 
 
 
 
79
 
80
- # Load Rasa model
81
- domain = Domain.load("insurance_domain.yml")
82
- interpreter = RasaNLUInterpreter("insurance_nlu.pkl")
83
- tracker_store = InMemoryTrackerStore(domain)
84
- agent = Agent.load("insurance_model", interpreter=interpreter, tracker_store=tracker_store)
85
-
86
- # Define Streamlit app
87
  st.title("Insurance Chatbot")
88
 
89
  user_input = st.text_area("You:", height=200)
90
 
91
  if st.button("Send"):
92
- response = agent.handle_text(user_input)
93
- st.text_area("Bot:", value=response[0].text, height=200, max_chars=None, key=None)
 
 
 
69
  # if "bot" in message:
70
  # st.write("**Bot:**", message["bot"])
71
 
72
+ #
 
 
 
 
 
73
 
74
+ insurance_knowledge = {
75
+ "What types of insurance do you offer?": "We offer auto, home, and life insurance policies.",
76
+ "How do I file a claim?": "To file a claim, you can call our customer service line at 1-800-123-4567 or submit a claim form on our website.",
77
+ "What is my policy coverage?": "Your policy details, including coverage limits and deductibles, can be found in your policy documents. If you need assistance, please contact our customer service team.",
78
+ "What is the process for getting a quote?": "To get a quote, you can fill out our online quote form or speak with one of our licensed insurance agents."
79
+ }
80
 
81
+ # Define the Streamlit app
 
 
 
 
 
 
82
  st.title("Insurance Chatbot")
83
 
84
  user_input = st.text_area("You:", height=200)
85
 
86
  if st.button("Send"):
87
+ if user_input.lower() in insurance_knowledge:
88
+ st.text_area("Bot:", value=insurance_knowledge[user_input.lower()], height=200, max_chars=None, key=None)
89
+ else:
90
+ st.text_area("Bot:", value="I'm sorry, I don't have information on that topic. Please try rephrasing your question or contact our customer service team for assistance.", height=200, max_chars=None, key=None)