Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, request, jsonify, abort
|
| 2 |
+
import tsadropboxretrieval
|
| 3 |
+
import findInitialMarkups
|
| 4 |
+
import requests
|
| 5 |
+
app = Flask(__name__)
|
| 6 |
+
|
| 7 |
+
@app.route("/",methods=["GET", "POST"])
|
| 8 |
+
def thismain():
|
| 9 |
+
print('ayhaga')
|
| 10 |
+
return jsonify('done')
|
| 11 |
+
|
| 12 |
+
@app.route('/api/process-data', methods=['POST'])
|
| 13 |
+
def process():
|
| 14 |
+
# check_api_key()
|
| 15 |
+
try:
|
| 16 |
+
|
| 17 |
+
print('In process [Try]')
|
| 18 |
+
# data = request.form
|
| 19 |
+
data = request.get_json()
|
| 20 |
+
# Extracting values
|
| 21 |
+
filePath = data.get('filePath')
|
| 22 |
+
print(filePath)
|
| 23 |
+
headers = findInitialMarkups.headersfrompdf(filePath)
|
| 24 |
+
return jsonify(headers)
|
| 25 |
+
|
| 26 |
+
except Exception as e:
|
| 27 |
+
print(f"Error: {e}")
|
| 28 |
+
return jsonify({"error": str(e)}), 500
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
if __name__ == '__main__':
|
| 33 |
+
app.run(host='0.0.0.0', port=7860)
|