ngd1210 commited on
Commit
67c9fd7
·
1 Parent(s): 062a468
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. routes/textToImage.py +11 -11
Dockerfile CHANGED
@@ -10,4 +10,4 @@ COPY --chown=user ./requirements.txt requirements.txt
10
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
 
12
  COPY --chown=user . /app
13
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
10
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
11
 
12
  COPY --chown=user . /app
13
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--debug"]
routes/textToImage.py CHANGED
@@ -6,18 +6,18 @@ import io
6
  router = APIRouter()
7
 
8
  @router.post("/v1/images/generations", tags=["Text to Image"])
9
- async def text_to_image(body: TextToImageRequest):
10
- client = InferenceClient(model=body.model)
11
  res = client.text_to_image(
12
- prompt=body.prompt,
13
- negative_prompt=body.negative_prompt,
14
- height=body.height,
15
- width=body.width,
16
- num_inference_steps=body.num_inference_steps,
17
- guidance_scale=body.guidance_scale,
18
- scheduler=body.scheduler,
19
- # target_size=body.target_size,
20
- seed=body.seed
21
  )
22
  img_byte_arr = io.BytesIO()
23
  res.save(img_byte_arr, format="PNG")
 
6
  router = APIRouter()
7
 
8
  @router.post("/v1/images/generations", tags=["Text to Image"])
9
+ async def text_to_image(t2i_body: TextToImageRequest):
10
+ client = InferenceClient(model=t2i_body.model)
11
  res = client.text_to_image(
12
+ prompt=t2i_body.prompt,
13
+ negative_prompt=t2i_body.negative_prompt,
14
+ height=t2i_body.height,
15
+ width=t2i_body.width,
16
+ num_inference_steps=t2i_body.num_inference_steps,
17
+ guidance_scale=t2i_body.guidance_scale,
18
+ scheduler=t2i_body.scheduler,
19
+ # target_size=t2i_body.target_size,
20
+ seed=t2i_body.seed
21
  )
22
  img_byte_arr = io.BytesIO()
23
  res.save(img_byte_arr, format="PNG")