Subbu1304 commited on
Commit
46d2b0a
·
verified ·
1 Parent(s): cb2d8a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -0
app.py CHANGED
@@ -1,6 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from flask import Flask, render_template, request, jsonify
 
2
 
3
  app = Flask(__name__)
 
4
 
5
  # Basic logic for chatbot responses
6
  def bot_response(user_message):
@@ -45,3 +96,4 @@ def chat():
45
 
46
  if __name__ == "__main__":
47
  app.run(debug=True)
 
 
1
+ # from flask import Flask, render_template, request, jsonify
2
+
3
+ # app = Flask(__name__)
4
+
5
+ # # Basic logic for chatbot responses
6
+ # def bot_response(user_message):
7
+ # lower_case_message = user_message.lower()
8
+ # response = ""
9
+
10
+ # # Simple responses based on user input
11
+ # if "hello" in lower_case_message or "hi" in lower_case_message:
12
+ # response = "Hello! Welcome to our restaurant. How can I assist you today?"
13
+ # elif "menu" in lower_case_message:
14
+ # response = "Our menu includes: Pizza, Pasta, Burger, Salad, and Desserts. What would you like to order?"
15
+ # elif "order" in lower_case_message or "buy" in lower_case_message:
16
+ # response = "What would you like to order from the menu?"
17
+ # elif "pizza" in lower_case_message:
18
+ # response = "Great choice! Our pizzas are delicious. Would you like a small, medium, or large pizza?"
19
+ # elif "pasta" in lower_case_message:
20
+ # response = "Yum! Our pasta is freshly made. Would you like it with marinara sauce or Alfredo?"
21
+ # elif "burger" in lower_case_message:
22
+ # response = "Our burgers are served with fries. Would you like a vegetarian or beef burger?"
23
+ # elif "salad" in lower_case_message:
24
+ # response = "We have a variety of salads. Would you like a Caesar salad or a garden salad?"
25
+ # elif "dessert" in lower_case_message:
26
+ # response = "For dessert, we have cakes, ice cream, and pie. What would you like to try?"
27
+ # else:
28
+ # response = "I'm sorry, I didn't quite get that. Can you please repeat?"
29
+
30
+ # return response
31
+
32
+ # # Home route to serve the chatbot's HTML page
33
+ # @app.route('/')
34
+ # def index():
35
+ # return render_template('index.html')
36
+
37
+ # # API route for handling user input and getting the bot's response
38
+ # @app.route('/chat', methods=['POST'])
39
+ # def chat():
40
+ # user_message = request.json.get('message')
41
+ # if user_message:
42
+ # response = bot_response(user_message)
43
+ # return jsonify({'response': response})
44
+ # return jsonify({'response': 'Sorry, I could not understand that.'})
45
+
46
+ # if __name__ == "__main__":
47
+
48
+ # app.run(debug=True)
49
+
50
  from flask import Flask, render_template, request, jsonify
51
+ from flask_cors import CORS # Importing CORS for handling cross-origin requests
52
 
53
  app = Flask(__name__)
54
+ CORS(app) # Enabling CORS for the entire app
55
 
56
  # Basic logic for chatbot responses
57
  def bot_response(user_message):
 
96
 
97
  if __name__ == "__main__":
98
  app.run(debug=True)
99
+