Upload 2 files
Browse files- app.py +6 -13
- requirements.txt +4 -1
app.py
CHANGED
|
@@ -5,9 +5,12 @@ import pytesseract
|
|
| 5 |
from pdf2image import convert_from_bytes
|
| 6 |
from flask_cors import CORS
|
| 7 |
from lib import ocr_1
|
|
|
|
| 8 |
|
| 9 |
os.environ['TESSDATA_PREFIX'] = '/usr/share/tesseract-ocr/5/tessdata'
|
| 10 |
|
|
|
|
|
|
|
| 11 |
app = Flask(__name__)
|
| 12 |
CORS(app)
|
| 13 |
UPLOAD_FOLDER = './tmp'
|
|
@@ -56,20 +59,10 @@ def upload_file():
|
|
| 56 |
def analize():
|
| 57 |
# Get the text data from the request
|
| 58 |
text_data = request.json.get('text')
|
| 59 |
-
|
| 60 |
-
# Process the text data and generate the JSON response
|
| 61 |
-
result = []
|
| 62 |
-
|
| 63 |
-
# Example processing: Split the text into two groups
|
| 64 |
-
group1 = [{"название параметра группы 1": word} for word in text_data.split()[:len(text_data)//2]]
|
| 65 |
-
group2 = [{"название параметра группы 2": word} for word in text_data.split()[len(text_data)//2:]]
|
| 66 |
-
|
| 67 |
-
# Append the groups to the result list
|
| 68 |
-
result.append(group1)
|
| 69 |
-
result.append(group2)
|
| 70 |
|
| 71 |
# Return the JSON response
|
| 72 |
-
return jsonify(
|
| 73 |
|
| 74 |
if __name__ == '__main__':
|
| 75 |
-
app.run(debug=
|
|
|
|
| 5 |
from pdf2image import convert_from_bytes
|
| 6 |
from flask_cors import CORS
|
| 7 |
from lib import ocr_1
|
| 8 |
+
from lib import llm_2
|
| 9 |
|
| 10 |
os.environ['TESSDATA_PREFIX'] = '/usr/share/tesseract-ocr/5/tessdata'
|
| 11 |
|
| 12 |
+
|
| 13 |
+
|
| 14 |
app = Flask(__name__)
|
| 15 |
CORS(app)
|
| 16 |
UPLOAD_FOLDER = './tmp'
|
|
|
|
| 59 |
def analize():
|
| 60 |
# Get the text data from the request
|
| 61 |
text_data = request.json.get('text')
|
| 62 |
+
app_info = llm_2.getApplicationInfo(text_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
# Return the JSON response
|
| 65 |
+
return jsonify(app_info)
|
| 66 |
|
| 67 |
if __name__ == '__main__':
|
| 68 |
+
app.run(debug=False)
|
requirements.txt
CHANGED
|
@@ -5,4 +5,7 @@ pdf2image
|
|
| 5 |
opencv-python
|
| 6 |
matplotlib
|
| 7 |
numpy
|
| 8 |
-
pillow
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
opencv-python
|
| 6 |
matplotlib
|
| 7 |
numpy
|
| 8 |
+
pillow
|
| 9 |
+
pandas
|
| 10 |
+
requests
|
| 11 |
+
openpyxl
|