Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -49,7 +49,9 @@ async def root():
|
|
49 |
|
50 |
@app.post("/text-to-image/")
|
51 |
async def text_to_image(
|
52 |
-
request: Request,
|
|
|
|
|
53 |
):
|
54 |
image = request.state.text2img(
|
55 |
prompt=prompt, num_inference_steps=num_inference_steps, guidance_scale=0.0
|
@@ -64,10 +66,10 @@ async def text_to_image(
|
|
64 |
@app.post("/image-to-image/")
|
65 |
async def image_to_image(
|
66 |
request: Request,
|
67 |
-
prompt: str
|
68 |
-
init_bytes: bytes
|
69 |
-
num_inference_steps: int =
|
70 |
-
strength: float =
|
71 |
):
|
72 |
# init_bytes = await init_image.read()
|
73 |
init_image = Image.open(BytesIO(init_bytes))
|
@@ -90,11 +92,11 @@ async def image_to_image(
|
|
90 |
@app.post("/inpainting/")
|
91 |
async def inpainting(
|
92 |
request: Request,
|
93 |
-
prompt: str
|
94 |
-
init_bytes: bytes
|
95 |
-
mask_bytes: bytes
|
96 |
-
num_inference_steps: int =
|
97 |
-
strength: float =
|
98 |
):
|
99 |
# init_bytes = await init_image.read()
|
100 |
init_image = Image.open(BytesIO(init_bytes))
|
|
|
49 |
|
50 |
@app.post("/text-to-image/")
|
51 |
async def text_to_image(
|
52 |
+
request: Request,
|
53 |
+
prompt: str,
|
54 |
+
num_inference_steps: int = 1,
|
55 |
):
|
56 |
image = request.state.text2img(
|
57 |
prompt=prompt, num_inference_steps=num_inference_steps, guidance_scale=0.0
|
|
|
66 |
@app.post("/image-to-image/")
|
67 |
async def image_to_image(
|
68 |
request: Request,
|
69 |
+
prompt: str,
|
70 |
+
init_bytes: bytes,
|
71 |
+
num_inference_steps: int = 2,
|
72 |
+
strength: float = 1.0,
|
73 |
):
|
74 |
# init_bytes = await init_image.read()
|
75 |
init_image = Image.open(BytesIO(init_bytes))
|
|
|
92 |
@app.post("/inpainting/")
|
93 |
async def inpainting(
|
94 |
request: Request,
|
95 |
+
prompt: str,
|
96 |
+
init_bytes: bytes,
|
97 |
+
mask_bytes: bytes,
|
98 |
+
num_inference_steps: int = 2,
|
99 |
+
strength: float = 1.0,
|
100 |
):
|
101 |
# init_bytes = await init_image.read()
|
102 |
init_image = Image.open(BytesIO(init_bytes))
|