TANMIHA commited on
Commit
fb9dd6e
·
verified ·
1 Parent(s): 56c96bd

Delete server_exercise.py

Browse files
Files changed (1) hide show
  1. server_exercise.py +0 -34
server_exercise.py DELETED
@@ -1,34 +0,0 @@
1
- import logging
2
- import os
3
- from flask import Flask, render_template, request, jsonify
4
- from flask_cors import CORS
5
- import worker # Import the worker module
6
-
7
- # Initialize Flask app and CORS
8
- app = Flask(__name__)
9
- cors = CORS(app, resources={r"/*": {"origins": "*"}})
10
- app.logger.setLevel(logging.ERROR)
11
-
12
- # Define the route for the index page
13
- @app.route('/', methods=['GET'])
14
- def index():
15
- return render_template('index.html') # Render the index.html template
16
-
17
- # Define the route for processing messages
18
- @app.route('/process-message', methods=['POST'])
19
- def process_message_route():
20
-
21
- # TODO: Extract the user's message from the request
22
- # TODO: Process the user's message using the worker module
23
- # TODO: Return the bot's response as JSON
24
-
25
- # Define the route for processing documents
26
- @app.route('/process-document', methods=['POST'])
27
- def process_document_route():
28
- # TODO: Check if a file was uploaded --> use if 'file' not in request file then return jsofify message and error code 400
29
- # TODO: Save the uploaded file --> extracte the file with request
30
- # TODO: Process the saved file --> create proper file_path for saving
31
- # TODO: Send a response indicating that the document is ready for queries --> retrun jsonify message with code 200
32
-
33
- # Run the Flask app (later you need to add "python main block" ==> if __name__ == "__main__":
34
- app.run(debug=True, port=8000, host='0.0.0.0')