VikramSingh178
commited on
Commit
•
f384f5a
1
Parent(s):
0695699
chore: Update Dockerfile and requirements.txt for Huggingface Spaces deployment
Browse filesFormer-commit-id: 348186a5e11ccfaf073fb3abadd0f5f21ad754ec [formerly 6972c89f89c3e6a6f54549211b4d5482a70103d5]
Former-commit-id: 0a43bc1515b0cfbceb025ff39ba7d15ac7dc5d67
- .github/workflows/build-docker.yml +1 -1
- DockerFile +31 -0
- api/__pycache__/endpoints.cpython-311.pyc +0 -0
- api/endpoints.py +1 -1
- api/models/__pycache__/__init__.cpython-311.pyc +0 -0
- api/models/__pycache__/sdxl_input.cpython-311.pyc +0 -0
- api/requirements.txt +1 -0
- api/routers/__pycache__/painting.cpython-311.pyc +0 -0
- api/routers/__pycache__/sdxl_text_to_image.cpython-311.pyc +0 -0
- api/routers/sdxl_text_to_image.py +2 -2
- scripts/__pycache__/config.cpython-311.pyc +0 -0
- scripts/__pycache__/inpainting_pipeline.cpython-311.pyc +0 -0
- scripts/__pycache__/utils.cpython-311.pyc +0 -0
- scripts/config.py +1 -1
.github/workflows/build-docker.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
name: Push to
|
2 |
|
3 |
on:
|
4 |
push:
|
|
|
1 |
+
name: Push Image to Huggingface Spaces
|
2 |
|
3 |
on:
|
4 |
push:
|
DockerFile
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Python base image
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# Set the initial working directory
|
5 |
+
WORKDIR /api
|
6 |
+
|
7 |
+
# Copy the requirements.txt file from the api directory
|
8 |
+
COPY api/requirements.txt ./
|
9 |
+
|
10 |
+
# Install dependencies specified in requirements.txt
|
11 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
12 |
+
|
13 |
+
# Create a non-root user and set up the environment
|
14 |
+
RUN useradd -m -u 1000 user
|
15 |
+
|
16 |
+
USER user
|
17 |
+
|
18 |
+
ENV HOME=/home/user \
|
19 |
+
PATH=/home/user/.local/bin:$PATH
|
20 |
+
|
21 |
+
# Set the final working directory
|
22 |
+
WORKDIR $HOME/app
|
23 |
+
|
24 |
+
# Copy the entire project into the container, setting the appropriate ownership
|
25 |
+
COPY --chown=user . $HOME/app
|
26 |
+
|
27 |
+
# Set the working directory to /home/user/app/api
|
28 |
+
WORKDIR $HOME/app/api
|
29 |
+
|
30 |
+
# Command to run the API
|
31 |
+
CMD ["python", "endpoints.py"]
|
api/__pycache__/endpoints.cpython-311.pyc
CHANGED
Binary files a/api/__pycache__/endpoints.cpython-311.pyc and b/api/__pycache__/endpoints.cpython-311.pyc differ
|
|
api/endpoints.py
CHANGED
@@ -52,4 +52,4 @@ def check_health():
|
|
52 |
|
53 |
|
54 |
|
55 |
-
uvicorn.run(app, host='127.0.0.1', port=
|
|
|
52 |
|
53 |
|
54 |
|
55 |
+
uvicorn.run(app, host='127.0.0.1', port=7860)
|
api/models/__pycache__/__init__.cpython-311.pyc
CHANGED
Binary files a/api/models/__pycache__/__init__.cpython-311.pyc and b/api/models/__pycache__/__init__.cpython-311.pyc differ
|
|
api/models/__pycache__/sdxl_input.cpython-311.pyc
CHANGED
Binary files a/api/models/__pycache__/sdxl_input.cpython-311.pyc and b/api/models/__pycache__/sdxl_input.cpython-311.pyc differ
|
|
api/requirements.txt
CHANGED
@@ -10,3 +10,4 @@ pydantic==2.7.4
|
|
10 |
torch==2.2.0
|
11 |
utils==1.0.2
|
12 |
uvicorn==0.30.1
|
|
|
|
10 |
torch==2.2.0
|
11 |
utils==1.0.2
|
12 |
uvicorn==0.30.1
|
13 |
+
boto3
|
api/routers/__pycache__/painting.cpython-311.pyc
ADDED
Binary file (10.6 kB). View file
|
|
api/routers/__pycache__/sdxl_text_to_image.cpython-311.pyc
ADDED
Binary file (9.43 kB). View file
|
|
api/routers/sdxl_text_to_image.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import sys
|
2 |
-
sys.path.append("
|
3 |
import config
|
4 |
from fastapi import APIRouter, HTTPException
|
5 |
from pydantic import BaseModel
|
@@ -32,7 +32,7 @@ router = APIRouter()
|
|
32 |
|
33 |
|
34 |
# Load the diffusion pipeline
|
35 |
-
|
36 |
def load_pipeline(model_name, adapter_name,enable_compile:bool):
|
37 |
"""
|
38 |
Load the diffusion pipeline with the specified model and adapter names.
|
|
|
1 |
import sys
|
2 |
+
sys.path.append("../../scripts") # Path of the scripts directory
|
3 |
import config
|
4 |
from fastapi import APIRouter, HTTPException
|
5 |
from pydantic import BaseModel
|
|
|
32 |
|
33 |
|
34 |
# Load the diffusion pipeline
|
35 |
+
@lru_cache(maxsize=1)
|
36 |
def load_pipeline(model_name, adapter_name,enable_compile:bool):
|
37 |
"""
|
38 |
Load the diffusion pipeline with the specified model and adapter names.
|
scripts/__pycache__/config.cpython-311.pyc
CHANGED
Binary files a/scripts/__pycache__/config.cpython-311.pyc and b/scripts/__pycache__/config.cpython-311.pyc differ
|
|
scripts/__pycache__/inpainting_pipeline.cpython-311.pyc
CHANGED
Binary files a/scripts/__pycache__/inpainting_pipeline.cpython-311.pyc and b/scripts/__pycache__/inpainting_pipeline.cpython-311.pyc differ
|
|
scripts/__pycache__/utils.cpython-311.pyc
CHANGED
Binary files a/scripts/__pycache__/utils.cpython-311.pyc and b/scripts/__pycache__/utils.cpython-311.pyc differ
|
|
scripts/config.py
CHANGED
@@ -8,7 +8,7 @@ PRODUCTS_10k_DATASET = "VikramSingh178/Products-10k-BLIP-captions"
|
|
8 |
CAPTIONING_MODEL_NAME = "Salesforce/blip-image-captioning-base"
|
9 |
SEGMENTATION_MODEL_NAME = "facebook/sam-vit-large"
|
10 |
DETECTION_MODEL_NAME = "yolov8l"
|
11 |
-
ENABLE_COMPILE =
|
12 |
INPAINTING_MODEL_NAME = 'kandinsky-community/kandinsky-2-2-decoder-inpaint'
|
13 |
|
14 |
|
|
|
8 |
CAPTIONING_MODEL_NAME = "Salesforce/blip-image-captioning-base"
|
9 |
SEGMENTATION_MODEL_NAME = "facebook/sam-vit-large"
|
10 |
DETECTION_MODEL_NAME = "yolov8l"
|
11 |
+
ENABLE_COMPILE = True
|
12 |
INPAINTING_MODEL_NAME = 'kandinsky-community/kandinsky-2-2-decoder-inpaint'
|
13 |
|
14 |
|