ahmedmbutt commited on
Commit
5f08049
·
verified ·
1 Parent(s): 907f26d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -10
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, prompt: str = Form(...), num_inference_steps: int = Form(1)
 
 
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 = Form(...),
68
- init_bytes: bytes = Form(...),
69
- num_inference_steps: int = Form(2),
70
- strength: float = Form(0.5),
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 = Form(...),
94
- init_bytes: bytes = Form(...),
95
- mask_bytes: bytes = Form(...),
96
- num_inference_steps: int = Form(2),
97
- strength: float = Form(0.5),
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))