Next7years commited on
Commit
f7eff41
1 Parent(s): 2ec368a
Files changed (3) hide show
  1. Dockerfile +5 -7
  2. README.md +0 -1
  3. main.py +3 -1
Dockerfile CHANGED
@@ -1,16 +1,15 @@
 
1
  FROM python:3.9
2
 
 
3
  WORKDIR /code
4
 
 
5
  COPY ./requirements.txt /code/requirements.txt
6
 
 
7
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
9
- # Expose the secret SECRET_EXAMPLE at buildtime and use its value as git remote URL
10
- # RUN --mount=type=secret,id=SECRET_EXAMPLE,mode=0444,required=true \
11
- # git init && \
12
- # git remote add origin $(cat /run/secrets/SECRET_EXAMPLE)
13
-
14
  # Set up a new user named "user" with user ID 1000
15
  RUN useradd -m -u 1000 user
16
  # Switch to the "user" user
@@ -25,5 +24,4 @@ WORKDIR $HOME/app
25
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
26
  COPY --chown=user . $HOME/app
27
 
28
-
29
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7861"]
 
1
+ # Use the official Python 3.9 image
2
  FROM python:3.9
3
 
4
+ # Set the working directory to /code
5
  WORKDIR /code
6
 
7
+ # Copy the current directory contents into the container at /code
8
  COPY ./requirements.txt /code/requirements.txt
9
 
10
+ # Install requirements.txt
11
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
 
 
 
 
 
 
13
  # Set up a new user named "user" with user ID 1000
14
  RUN useradd -m -u 1000 user
15
  # Switch to the "user" user
 
24
  # Copy the current directory contents into the container at $HOME/app setting the owner to the user
25
  COPY --chown=user . $HOME/app
26
 
27
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
README.md CHANGED
@@ -6,7 +6,6 @@ colorTo: pink
6
  sdk: docker
7
  pinned: false
8
  license: openrail
9
- app_port: 7861
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
6
  sdk: docker
7
  pinned: false
8
  license: openrail
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
main.py CHANGED
@@ -8,8 +8,10 @@ app = FastAPI()
8
  def read_root():
9
  return {"Hello": "World!"}
10
 
 
11
  @app.post("/generate")
12
  def generate_image(input: str):
13
  model = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
14
 
15
- return {"image": "hello from the server", "input": input}
 
 
8
  def read_root():
9
  return {"Hello": "World!"}
10
 
11
+ '''
12
  @app.post("/generate")
13
  def generate_image(input: str):
14
  model = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
15
 
16
+ return {"image": "hello from the server", "input": input}
17
+ '''