Spaces:
Running
on
Zero
Running
on
Zero
change simple
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ def sanitize_prompt(prompt):
|
|
| 24 |
return sanitized_prompt
|
| 25 |
|
| 26 |
#@spaces.GPU
|
| 27 |
-
def process_img2img(image,mask_image,prompt="a person",
|
| 28 |
print("start process image process_image")
|
| 29 |
if image == None:
|
| 30 |
print("empty input image returned")
|
|
@@ -43,7 +43,7 @@ def process_img2img(image,mask_image,prompt="a person",model_id="black-forest-la
|
|
| 43 |
|
| 44 |
|
| 45 |
@spaces.GPU(duration=180)
|
| 46 |
-
def process_images(image, image2=None,prompt="a girl",
|
| 47 |
print("start process_images")
|
| 48 |
try:
|
| 49 |
# I'm not sure when this happen
|
|
@@ -65,7 +65,7 @@ def process_images(image, image2=None,prompt="a girl",inpaint_model="black-fores
|
|
| 65 |
mask = image['layers'][0]
|
| 66 |
|
| 67 |
|
| 68 |
-
output = process_img2img(image["background"],mask,prompt,
|
| 69 |
except Exception as e:
|
| 70 |
print(f"An error occurred: {e}")
|
| 71 |
gr.Error(e)
|
|
@@ -117,8 +117,8 @@ with demo_blocks as demo:
|
|
| 117 |
with gr.Row( equal_height=True):
|
| 118 |
strength = gr.Number(value=0.75, minimum=0, maximum=1.0, step=0.01, label="strength")
|
| 119 |
seed = gr.Number(value=0, minimum=0, step=1, label="seed")
|
| 120 |
-
models = ["black-forest-labs/FLUX.1-schnell"]
|
| 121 |
-
inpaint_model = gr.Dropdown(label="modes", choices=models, value="black-forest-labs/FLUX.1-schnell")
|
| 122 |
id_input=gr.Text(label="Name", visible=False)
|
| 123 |
|
| 124 |
with gr.Column():
|
|
@@ -127,7 +127,7 @@ with demo_blocks as demo:
|
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
-
btn.click(fn=process_images, inputs=[image, image_mask,prompt,
|
| 131 |
gr.Examples(
|
| 132 |
examples=[
|
| 133 |
#["images/00547245_99.jpg", "images/00547245_99_mask.jpg","a beautiful girl,eyes closed",0.8,"images/00547245.jpg"],
|
|
|
|
| 24 |
return sanitized_prompt
|
| 25 |
|
| 26 |
#@spaces.GPU
|
| 27 |
+
def process_img2img(image,mask_image,prompt="a person",strength=0.75,seed=0,num_inference_steps=4):
|
| 28 |
print("start process image process_image")
|
| 29 |
if image == None:
|
| 30 |
print("empty input image returned")
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
@spaces.GPU(duration=180)
|
| 46 |
+
def process_images(image, image2=None,prompt="a girl",strength=0.75,seed=0,progress=gr.Progress(track_tqdm=True)):
|
| 47 |
print("start process_images")
|
| 48 |
try:
|
| 49 |
# I'm not sure when this happen
|
|
|
|
| 65 |
mask = image['layers'][0]
|
| 66 |
|
| 67 |
|
| 68 |
+
output = process_img2img(image["background"],mask,prompt,strength,seed)
|
| 69 |
except Exception as e:
|
| 70 |
print(f"An error occurred: {e}")
|
| 71 |
gr.Error(e)
|
|
|
|
| 117 |
with gr.Row( equal_height=True):
|
| 118 |
strength = gr.Number(value=0.75, minimum=0, maximum=1.0, step=0.01, label="strength")
|
| 119 |
seed = gr.Number(value=0, minimum=0, step=1, label="seed")
|
| 120 |
+
#models = ["black-forest-labs/FLUX.1-schnell"]
|
| 121 |
+
#inpaint_model = gr.Dropdown(label="modes", choices=models, value="black-forest-labs/FLUX.1-schnell")
|
| 122 |
id_input=gr.Text(label="Name", visible=False)
|
| 123 |
|
| 124 |
with gr.Column():
|
|
|
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
+
btn.click(fn=process_images, inputs=[image, image_mask,prompt,strength,seed], outputs =image_out, api_name='infer')
|
| 131 |
gr.Examples(
|
| 132 |
examples=[
|
| 133 |
#["images/00547245_99.jpg", "images/00547245_99_mask.jpg","a beautiful girl,eyes closed",0.8,"images/00547245.jpg"],
|