Spaces:
Running
chore: Update roi_scale in inpainting.yaml and add gradio UI for SDXL LORA Inpainting
Browse filesFormer-commit-id: f419a0918b74c6b3a0596382efd9cf227aec6b48 [formerly d9b48f2c7818aa2732a3388320ed23afd13b49cd] [formerly f419a0918b74c6b3a0596382efd9cf227aec6b48 [formerly d9b48f2c7818aa2732a3388320ed23afd13b49cd] [formerly f419a0918b74c6b3a0596382efd9cf227aec6b48 [formerly d9b48f2c7818aa2732a3388320ed23afd13b49cd] [formerly f419a0918b74c6b3a0596382efd9cf227aec6b48 [formerly d9b48f2c7818aa2732a3388320ed23afd13b49cd] [formerly f419a0918b74c6b3a0596382efd9cf227aec6b48 [formerly d9b48f2c7818aa2732a3388320ed23afd13b49cd] [formerly b7b92f4bad53cf4a209420d4c71d1c87cdf69869 [formerly fbf9c06519715f33d9c88503d3d72e426703db29]]]]]]
Former-commit-id: 0aa3be7e8b70e3d2a7452d6eef126165d9187d38
Former-commit-id: b4009f9205d434a1c1ec1c796867581fd46be5ad
Former-commit-id: 27f2ea89e4cefe88a679f58b793b60fda74bdb3c
Former-commit-id: 4fcd420a6cf942ebe730e7caef8aa7c17dd007b6
Former-commit-id: 410555db43f015bf31bee853d3ea2a91fbf0d1bf
Former-commit-id: 6debc07bc4af309062c0565bd8341344a4d1cf2d
Former-commit-id: e2ec28519b8f4922f3044c4475180b08fa429c8d
- api/endpoints.py +6 -1
- api/yolov8s.pt.REMOVED.git-id +1 -0
- configs/inpainting.yaml +4 -0
- gradio-ui/ui.py +52 -0
- scripts/inpainting_pipeline.py +1 -1
@@ -50,6 +50,11 @@ async def root():
|
|
50 |
def check_health():
|
51 |
return {"status": "ok"}
|
52 |
|
|
|
53 |
|
54 |
|
55 |
-
uvicorn.run(app, host='127.0.0.1', port=7860)
|
|
|
|
|
|
|
|
|
|
50 |
def check_health():
|
51 |
return {"status": "ok"}
|
52 |
|
53 |
+
<<<<<<< HEAD:api/endpoints.py
|
54 |
|
55 |
|
56 |
+
uvicorn.run(app, host='127.0.0.1', port=7860)
|
57 |
+
=======
|
58 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
59 |
+
|
60 |
+
>>>>>>> cceaa9e (chore: Update roi_scale in inpainting.yaml and add gradio UI for SDXL LORA Inpainting):product_diffusion_api/endpoints.py
|
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
5f7efb1ee991ebccb1ee9a360066829e6435a168
|
@@ -7,10 +7,14 @@ target_height : 1472
|
|
7 |
prompt : 'Product on the table 4k ultrarealistic'
|
8 |
negative_prompt : 'low resolution , bad resolution , Deformation , Weird Artifacts, bad quality,blown up image, high brightness , high saturation '
|
9 |
<<<<<<< HEAD
|
|
|
10 |
roi_scale : 0.9
|
11 |
=======
|
12 |
roi_scale : 0.5
|
13 |
>>>>>>> bb1cf42 (chore: Update inpainting pipeline configuration and parameters)
|
|
|
|
|
|
|
14 |
strength : 0.6
|
15 |
guidance_scale : 7
|
16 |
num_inference_steps : 150
|
|
|
7 |
prompt : 'Product on the table 4k ultrarealistic'
|
8 |
negative_prompt : 'low resolution , bad resolution , Deformation , Weird Artifacts, bad quality,blown up image, high brightness , high saturation '
|
9 |
<<<<<<< HEAD
|
10 |
+
<<<<<<< HEAD
|
11 |
roi_scale : 0.9
|
12 |
=======
|
13 |
roi_scale : 0.5
|
14 |
>>>>>>> bb1cf42 (chore: Update inpainting pipeline configuration and parameters)
|
15 |
+
=======
|
16 |
+
roi_scale : 0.9
|
17 |
+
>>>>>>> cceaa9e (chore: Update roi_scale in inpainting.yaml and add gradio UI for SDXL LORA Inpainting)
|
18 |
strength : 0.6
|
19 |
guidance_scale : 7
|
20 |
num_inference_steps : 150
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import requests
|
3 |
+
from pydantic import BaseModel
|
4 |
+
|
5 |
+
# Define your API endpoint
|
6 |
+
SDXL_LORA_API_URL = 'http://127.0.0.1:8000/api/v1/product-diffusion/sdxl_v0_lora_inference'
|
7 |
+
|
8 |
+
# Define the InpaintingRequest model
|
9 |
+
class InpaintingRequest(BaseModel):
|
10 |
+
prompt: str
|
11 |
+
num_inference_steps: int
|
12 |
+
guidance_scale: float
|
13 |
+
negative_prompt: str
|
14 |
+
num_images: int
|
15 |
+
mode: str
|
16 |
+
|
17 |
+
def generate_sdxl_lora_image(prompt, negative_prompt, num_inference_steps, guidance_scale, num_images, mode):
|
18 |
+
# Prepare the payload for SDXL LORA API
|
19 |
+
payload = InpaintingRequest(
|
20 |
+
prompt=prompt,
|
21 |
+
negative_prompt=negative_prompt,
|
22 |
+
num_inference_steps=num_inference_steps,
|
23 |
+
guidance_scale=guidance_scale,
|
24 |
+
num_images=num_images,
|
25 |
+
mode=mode
|
26 |
+
).dict()
|
27 |
+
|
28 |
+
response = requests.post(SDXL_LORA_API_URL, json=payload)
|
29 |
+
if response.status_code == 200:
|
30 |
+
return response.json().get('image')
|
31 |
+
else:
|
32 |
+
return f"Error: {response.json().get('detail', 'Unknown error')}"
|
33 |
+
|
34 |
+
with gr.Blocks() as demo:
|
35 |
+
with gr.Tab("SDXL LORA Inpainting"):
|
36 |
+
gr.Markdown("## SDXL LORA Inpainting")
|
37 |
+
with gr.Row():
|
38 |
+
with gr.Column():
|
39 |
+
gr.Markdown("### Input Parameters")
|
40 |
+
prompt = gr.Textbox(label="Prompt", placeholder="Enter your prompt here")
|
41 |
+
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here")
|
42 |
+
num_inference_steps = gr.Slider(minimum=1, maximum=100, step=1, value=20, label="Inference Steps")
|
43 |
+
guidance_scale = gr.Slider(minimum=1.0, maximum=20.0, step=0.1, value=7.5, label="Guidance Scale")
|
44 |
+
num_images = gr.Slider(minimum=1, maximum=10, step=1, value=1, label="Number of Images")
|
45 |
+
mode = gr.Dropdown(choices=["s3_json", "default"], value="s3_json", label="Mode")
|
46 |
+
generate_button = gr.Button(value="Generate Image")
|
47 |
+
with gr.Column():
|
48 |
+
gr.Markdown("### Output")
|
49 |
+
output_image = gr.Image(label="Generated Image")
|
50 |
+
generate_button.click(fn=generate_sdxl_lora_image, inputs=[prompt, negative_prompt, num_inference_steps, guidance_scale, num_images, mode], outputs=output_image)
|
51 |
+
|
52 |
+
demo.launch()
|
@@ -19,7 +19,7 @@ def load_pipeline(model_name: str, device, enable_compile: bool = True):
|
|
19 |
pipeline.to(device)
|
20 |
return pipeline
|
21 |
|
22 |
-
|
23 |
class AutoPaintingPipeline:
|
24 |
def __init__(self, pipeline, image: Image, mask_image: Image, target_width: int, target_height: int):
|
25 |
self.pipeline = pipeline
|
|
|
19 |
pipeline.to(device)
|
20 |
return pipeline
|
21 |
|
22 |
+
|
23 |
class AutoPaintingPipeline:
|
24 |
def __init__(self, pipeline, image: Image, mask_image: Image, target_width: int, target_height: int):
|
25 |
self.pipeline = pipeline
|