Spaces:
Runtime error
Runtime error
Commit
·
7f6bab7
1
Parent(s):
749b55f
test
Browse files- Dockerfile +3 -0
- main.py +6 -0
- requirements.txt +2 -1
Dockerfile
CHANGED
@@ -8,6 +8,9 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
8 |
|
9 |
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
10 |
|
|
|
|
|
|
|
11 |
COPY . .
|
12 |
|
13 |
CMD ["gunicorn", "-b", "0.0.0.0:7860", "main:app"]
|
|
|
8 |
|
9 |
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
10 |
|
11 |
+
# Move the Hugging Face cache directory
|
12 |
+
RUN mv ~/.cache/huggingface/transformers ~/.cache/huggingface-tmp || true
|
13 |
+
|
14 |
COPY . .
|
15 |
|
16 |
CMD ["gunicorn", "-b", "0.0.0.0:7860", "main:app"]
|
main.py
CHANGED
@@ -1,11 +1,17 @@
|
|
1 |
from flask import Flask, jsonify
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
app = Flask(__name__)
|
|
|
5 |
|
6 |
# Load the sentiment-analysis pipeline from Hugging Face
|
7 |
sentiment_analyzer = pipeline('sentiment-analysis')
|
8 |
|
|
|
|
|
|
|
|
|
9 |
@app.route('/analyze', methods=['GET'])
|
10 |
def analyze():
|
11 |
sentence = "hey there"
|
|
|
1 |
from flask import Flask, jsonify
|
2 |
+
from flask_cors import CORS
|
3 |
from transformers import pipeline
|
4 |
|
5 |
app = Flask(__name__)
|
6 |
+
CORS(app)
|
7 |
|
8 |
# Load the sentiment-analysis pipeline from Hugging Face
|
9 |
sentiment_analyzer = pipeline('sentiment-analysis')
|
10 |
|
11 |
+
@app.route('/')
|
12 |
+
def hello():
|
13 |
+
return {"Goes Wrong": "Keeping it real"}
|
14 |
+
|
15 |
@app.route('/analyze', methods=['GET'])
|
16 |
def analyze():
|
17 |
sentence = "hey there"
|
requirements.txt
CHANGED
@@ -13,4 +13,5 @@ matplotlib # Required for image processing and mask visualization
|
|
13 |
onnxruntime
|
14 |
onnx
|
15 |
pycocotools
|
16 |
-
transformers
|
|
|
|
13 |
onnxruntime
|
14 |
onnx
|
15 |
pycocotools
|
16 |
+
transformers
|
17 |
+
torch
|