Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,13 +65,13 @@ def edit_image(img_data, operation, *args):
|
|
65 |
image = Image.open(img_data)
|
66 |
|
67 |
if operation == "rotate":
|
68 |
-
angle = args[0]
|
69 |
image = image.rotate(angle, expand=True)
|
70 |
elif operation == "crop":
|
71 |
-
left, top, right, bottom = args
|
72 |
image = image.crop((left, top, right, bottom))
|
73 |
elif operation == "resize":
|
74 |
-
width, height = args
|
75 |
image = image.resize((width, height))
|
76 |
elif operation == "flip":
|
77 |
if args[0] == "horizontal":
|
@@ -96,7 +96,7 @@ with gr.Blocks() as demo:
|
|
96 |
prompt_part4_back = gr.Textbox(label="back design", placeholder="back design")
|
97 |
prompt_part5 = gr.Textbox(value="hanging on the plain wall", label="Prompt Part 5")
|
98 |
|
99 |
-
run_button = gr.Button("
|
100 |
|
101 |
front_result = gr.Image(label="Front View Result", type="file", interactive=True)
|
102 |
back_result = gr.Image(label="Back View Result", type="file", interactive=True)
|
@@ -117,7 +117,7 @@ with gr.Blocks() as demo:
|
|
117 |
edit_button = gr.Button("Edit Front Design")
|
118 |
|
119 |
edit_button.click(
|
120 |
-
fn=lambda img_data, operation, args: edit_image(img_data, operation, *
|
121 |
inputs=[front_result, edit_operation, edit_args],
|
122 |
outputs=[front_result]
|
123 |
)
|
|
|
65 |
image = Image.open(img_data)
|
66 |
|
67 |
if operation == "rotate":
|
68 |
+
angle = int(args[0])
|
69 |
image = image.rotate(angle, expand=True)
|
70 |
elif operation == "crop":
|
71 |
+
left, top, right, bottom = map(int, args)
|
72 |
image = image.crop((left, top, right, bottom))
|
73 |
elif operation == "resize":
|
74 |
+
width, height = map(int, args)
|
75 |
image = image.resize((width, height))
|
76 |
elif operation == "flip":
|
77 |
if args[0] == "horizontal":
|
|
|
96 |
prompt_part4_back = gr.Textbox(label="back design", placeholder="back design")
|
97 |
prompt_part5 = gr.Textbox(value="hanging on the plain wall", label="Prompt Part 5")
|
98 |
|
99 |
+
run_button = gr.Button("Generate Designs")
|
100 |
|
101 |
front_result = gr.Image(label="Front View Result", type="file", interactive=True)
|
102 |
back_result = gr.Image(label="Back View Result", type="file", interactive=True)
|
|
|
117 |
edit_button = gr.Button("Edit Front Design")
|
118 |
|
119 |
edit_button.click(
|
120 |
+
fn=lambda img_data, operation, args: edit_image(img_data, operation, *args.split(',')),
|
121 |
inputs=[front_result, edit_operation, edit_args],
|
122 |
outputs=[front_result]
|
123 |
)
|