Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- Dockerfile +6 -2
- app.py +3 -3
Dockerfile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
# Use an official Python runtime as the parent image
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
|
@@ -25,9 +25,13 @@ COPY static/script.js static/
|
|
| 25 |
# Make port 8000 available to the world outside this container
|
| 26 |
EXPOSE 8000
|
| 27 |
|
| 28 |
-
# Define environment
|
| 29 |
ENV FLASK_APP=app.py
|
| 30 |
ENV FLASK_RUN_HOST=0.0.0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# Run app.py when the container launches
|
| 33 |
CMD ["flask", "run", "--port=8000"]
|
|
|
|
| 1 |
# Use an official Python runtime as the parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
|
|
|
| 25 |
# Make port 8000 available to the world outside this container
|
| 26 |
EXPOSE 8000
|
| 27 |
|
| 28 |
+
# Define environment variables
|
| 29 |
ENV FLASK_APP=app.py
|
| 30 |
ENV FLASK_RUN_HOST=0.0.0.0
|
| 31 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
|
| 32 |
+
|
| 33 |
+
# Create the cache directory
|
| 34 |
+
RUN mkdir -p /app/.cache/huggingface/hub
|
| 35 |
|
| 36 |
# Run app.py when the container launches
|
| 37 |
CMD ["flask", "run", "--port=8000"]
|
app.py
CHANGED
|
@@ -4,7 +4,7 @@ from transformers import pipeline
|
|
| 4 |
import mysql.connector
|
| 5 |
from groq import Groq
|
| 6 |
|
| 7 |
-
app = Flask(
|
| 8 |
|
| 9 |
# Initialize the text generation pipeline
|
| 10 |
pipe = pipeline("text-generation", model="defog/sqlcoder-7b-2")
|
|
@@ -79,5 +79,5 @@ def chatbot():
|
|
| 79 |
except Exception as e:
|
| 80 |
return jsonify({"error": str(e)}), 500
|
| 81 |
|
| 82 |
-
if
|
| 83 |
-
app.run(host='0.0.0.0', port=8000)
|
|
|
|
| 4 |
import mysql.connector
|
| 5 |
from groq import Groq
|
| 6 |
|
| 7 |
+
app = Flask(__name__)
|
| 8 |
|
| 9 |
# Initialize the text generation pipeline
|
| 10 |
pipe = pipeline("text-generation", model="defog/sqlcoder-7b-2")
|
|
|
|
| 79 |
except Exception as e:
|
| 80 |
return jsonify({"error": str(e)}), 500
|
| 81 |
|
| 82 |
+
if __name__ == '__main__':
|
| 83 |
+
app.run(host='0.0.0.0', port=8000)
|