Spaces:
Sleeping
Sleeping
++
Browse files- Dockerfile +1 -1
- 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(
|
10 |
-
client = InferenceClient(model=
|
11 |
res = client.text_to_image(
|
12 |
-
prompt=
|
13 |
-
negative_prompt=
|
14 |
-
height=
|
15 |
-
width=
|
16 |
-
num_inference_steps=
|
17 |
-
guidance_scale=
|
18 |
-
scheduler=
|
19 |
-
# target_size=
|
20 |
-
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")
|