vidyasharma17 commited on
Commit
08e5202
1 Parent(s): 3231283

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import json
2
  import pickle
3
  from sklearn.feature_extraction.text import CountVectorizer
4
  import gradio as gr
@@ -10,7 +9,7 @@ with open("naive_bayes_model.pkl", "rb") as model_file:
10
  with open("vectorizer.pkl", "rb") as vectorizer_file:
11
  vectorizer = pickle.load(vectorizer_file)
12
 
13
- # Define the responses dictionary
14
  responses = {
15
  "activate_my_card": "To activate your card, log in to the app and navigate to the 'Activate Card' section.",
16
  "age_limit": "The minimum age to use this service is 18 years.",
@@ -40,17 +39,15 @@ def chatbot_response(user_input):
40
  predicted_label = clf.predict(vectorized_input)[0]
41
  return responses.get(predicted_label, "Sorry, I couldn't understand your question.")
42
 
43
- # Define the Gradio interface
44
  interface = gr.Interface(
45
  fn=chatbot_response,
46
- inputs=gr.Textbox(lines=2, label="Your Question", placeholder="Type your fintech question here..."),
47
- outputs=gr.Textbox(label="Chatbot Response"),
48
- title="FinTech Chatbot",
49
- description="Ask your questions related to financial technology services, and I'll assist you!",
50
- theme="huggingface"
51
  )
52
 
53
-
54
  if __name__ == "__main__":
55
  # Launch the Gradio app
56
- interface.launch()
 
 
1
  import pickle
2
  from sklearn.feature_extraction.text import CountVectorizer
3
  import gradio as gr
 
9
  with open("vectorizer.pkl", "rb") as vectorizer_file:
10
  vectorizer = pickle.load(vectorizer_file)
11
 
12
+ # Define responses dictionary
13
  responses = {
14
  "activate_my_card": "To activate your card, log in to the app and navigate to the 'Activate Card' section.",
15
  "age_limit": "The minimum age to use this service is 18 years.",
 
39
  predicted_label = clf.predict(vectorized_input)[0]
40
  return responses.get(predicted_label, "Sorry, I couldn't understand your question.")
41
 
42
+ # Define Gradio interface
43
  interface = gr.Interface(
44
  fn=chatbot_response,
45
+ inputs=gr.Textbox(lines=2, placeholder="Ask your fintech question here..."),
46
+ outputs="text",
47
+ title="Banking Chatbot",
48
+ description="A chatbot to handle banking-related queries using a Naive Bayes model."
 
49
  )
50
 
 
51
  if __name__ == "__main__":
52
  # Launch the Gradio app
53
+ interface.launch()