Marthee commited on
Commit
501c5ba
·
verified ·
1 Parent(s): 1cdd415

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, jsonify, abort
2
+
3
+ app = Flask(__name__)
4
+ API_KEY = "adrpdftotext" # Replace with your actual API key
5
+
6
+ def check_api_key():
7
+ api_key = request.headers.get("x-api-key")
8
+ if api_key != API_KEY:
9
+ abort(403) # Forbidden if API key is missing or incorrect
10
+
11
+ @app.route('/process', methods=['POST'])
12
+ def process():
13
+ check_api_key()
14
+ data = request.json
15
+ print(data)
16
+ #pdftext=pythoncode.pdftotext(data)
17
+ # Process the data
18
+ response_data = {
19
+ "message": "Data received",
20
+ "input_data": data #pdftext
21
+ }
22
+ return jsonify(response_data)
23
+
24
+ if __name__ == '__main__':
25
+ app.run(host='0.0.0.0', port=7860)