Commit
·
2fa128a
1
Parent(s):
5698b24
fix req 9
Browse files- main.py +8 -2
- requirements.txt +1 -0
main.py
CHANGED
@@ -1,8 +1,14 @@
|
|
1 |
import os
|
2 |
-
import sys
|
3 |
import tempfile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
import logging
|
5 |
-
import
|
6 |
from flask import Flask, request, jsonify, render_template, send_file, Response
|
7 |
from werkzeug.utils import secure_filename
|
8 |
import cv2
|
|
|
1 |
import os
|
|
|
2 |
import tempfile
|
3 |
+
|
4 |
+
# Set up Hugging Face cache directory
|
5 |
+
os.environ['TRANSFORMERS_CACHE'] = os.path.join(tempfile.gettempdir(), 'huggingface_cache')
|
6 |
+
os.makedirs(os.environ['TRANSFORMERS_CACHE'], exist_ok=True)
|
7 |
+
|
8 |
+
# Now import the rest of the dependencies
|
9 |
+
import sys
|
10 |
import logging
|
11 |
+
from pathlib import Path
|
12 |
from flask import Flask, request, jsonify, render_template, send_file, Response
|
13 |
from werkzeug.utils import secure_filename
|
14 |
import cv2
|
requirements.txt
CHANGED
@@ -3,6 +3,7 @@ flask==2.0.1
|
|
3 |
torch==2.0.0
|
4 |
torchvision==0.15.1
|
5 |
transformers==4.30.2
|
|
|
6 |
sentence-transformers==2.2.2
|
7 |
opencv-python==4.5.3.56
|
8 |
flask-cors==3.0.10
|
|
|
3 |
torch==2.0.0
|
4 |
torchvision==0.15.1
|
5 |
transformers==4.30.2
|
6 |
+
huggingface_hub==0.13.4
|
7 |
sentence-transformers==2.2.2
|
8 |
opencv-python==4.5.3.56
|
9 |
flask-cors==3.0.10
|