Spaces:
Running
on
Zero
Running
on
Zero
update app so it will be nicer
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ def preprocess_map(map):
|
|
42 |
return map
|
43 |
|
44 |
|
45 |
-
def inference(image, map,gs, prompt, negative_prompt):
|
46 |
validate_inputs(image, map)
|
47 |
image = preprocess_image(image)
|
48 |
map = preprocess_map(map)
|
@@ -68,14 +68,28 @@ def validate_inputs(image, map):
|
|
68 |
|
69 |
|
70 |
example1 = ["assets/input2.jpg", "assets/map2.jpg", 17.5,
|
71 |
-
|
72 |
-
|
73 |
-
example2=["assets/input3.jpg", "assets/map4.png", 21,
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
if __name__ == "__main__":
|
81 |
demo.launch()
|
|
|
|
42 |
return map
|
43 |
|
44 |
|
45 |
+
def inference(image, map, gs, prompt, negative_prompt):
|
46 |
validate_inputs(image, map)
|
47 |
image = preprocess_image(image)
|
48 |
map = preprocess_map(map)
|
|
|
68 |
|
69 |
|
70 |
example1 = ["assets/input2.jpg", "assets/map2.jpg", 17.5,
|
71 |
+
"Tree of life under the sea, ethereal, glittering, lens flares, cinematic lighting, artwork by Anna Dittmann & Carne Griffiths, 8k, unreal engine 5, hightly detailed, intricate detailed",
|
72 |
+
"bad anatomy, poorly drawn face, out of frame, gibberish, lowres, duplicate, morbid, darkness, maniacal, creepy, fused, blurry background, crosseyed, extra limbs, mutilated, dehydrated, surprised, poor quality, uneven, off-centered, bird illustration, painting, cartoons"]
|
73 |
+
example2 = ["assets/input3.jpg", "assets/map4.png", 21,
|
74 |
+
"overgrown atrium, nature, ancient black marble columns and terracotta tile floors, waterfall, ultra-high quality, octane render, corona render, UHD, 64k",
|
75 |
+
"Two bodies, Two heads, doll, extra nipples, bad anatomy, blurry, fuzzy, extra arms, extra fingers, poorly drawn hands, disfigured, tiling, deformed, mutated, out of frame, cloned face, watermark, text, lowres, disfigured, ostentatious, ugly, oversaturated, grain, low resolution, blurry, bad anatomy, poorly drawn face, mutant, mutated, blurred, out of focus, long neck, long body, ugly, disgusting, bad drawing, childish"]
|
76 |
+
with gr.Blocks() as demo:
|
77 |
+
with gr.Row():
|
78 |
+
with gr.Column():
|
79 |
+
with gr.Row():
|
80 |
+
input_image = gr.Image(label="input image", type="pil", height="40vh", width="10vw")
|
81 |
+
change_map = gr.Image(label="change map", type="pil", height="40vh", width="10vw")
|
82 |
+
gs = gr.Slider(0, 28, value=7.5, label="Guidance Scale")
|
83 |
+
prompt = gr.Textbox(label="Prompt")
|
84 |
+
neg_prompt = gr.Textbox(label="Negative Prompt")
|
85 |
+
with gr.Row():
|
86 |
+
clr_btn=gr.ClearButton(components=[input_image, change_map, gs, prompt, neg_prompt])
|
87 |
+
run_btn = gr.Button("Run",variant="primary")
|
88 |
+
|
89 |
+
output = gr.Image(label="output image")
|
90 |
+
gr.Examples(examples=[example1, example2],inputs=[input_image, change_map, gs, prompt, neg_prompt])
|
91 |
+
run_btn.click(inference, inputs=[input_image, change_map, gs, prompt, neg_prompt], outputs=output)
|
92 |
+
clr_btn.add(output)
|
93 |
if __name__ == "__main__":
|
94 |
demo.launch()
|
95 |
+
|