Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,11 +137,6 @@ with gr.Blocks(title="Style Mixing for Clothing Design") as iface:
|
|
| 137 |
|
| 138 |
user_id_state = gr.State()
|
| 139 |
|
| 140 |
-
@iface.load
|
| 141 |
-
def on_load(request: gr.Request):
|
| 142 |
-
user_id = request.query_params.get('user_id', '')
|
| 143 |
-
return user_id
|
| 144 |
-
|
| 145 |
gr.Markdown("## Style Mixing for Clothing Design\nUpload two projected clothing images and mix their styles.")
|
| 146 |
|
| 147 |
with gr.Row():
|
|
@@ -161,8 +156,25 @@ with gr.Blocks(title="Style Mixing for Clothing Design") as iface:
|
|
| 161 |
result_image, buffer = style_mixing_interface(image1, image2, mix_value)
|
| 162 |
return result_image, buffer
|
| 163 |
|
| 164 |
-
mix_slider.change(
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
iface.launch()
|
| 168 |
|
|
|
|
| 137 |
|
| 138 |
user_id_state = gr.State()
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
gr.Markdown("## Style Mixing for Clothing Design\nUpload two projected clothing images and mix their styles.")
|
| 141 |
|
| 142 |
with gr.Row():
|
|
|
|
| 156 |
result_image, buffer = style_mixing_interface(image1, image2, mix_value)
|
| 157 |
return result_image, buffer
|
| 158 |
|
| 159 |
+
mix_slider.change(
|
| 160 |
+
mix_and_store,
|
| 161 |
+
inputs=[image1_input, image2_input, mix_slider],
|
| 162 |
+
outputs=[output_image, image_buffer]
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
save_button.click(
|
| 166 |
+
send_to_backend,
|
| 167 |
+
inputs=[image_buffer, user_id_state],
|
| 168 |
+
outputs=[save_status]
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
@iface.load
|
| 172 |
+
def on_load(request: gr.Request):
|
| 173 |
+
user_id = request.query_params.get("user_id", "")
|
| 174 |
+
return gr.update(value=user_id) # This updates the user_id_state
|
| 175 |
+
|
| 176 |
+
# Bind the return of on_load to user_id_state
|
| 177 |
+
iface.load(on_load, None, [user_id_state])
|
| 178 |
|
| 179 |
iface.launch()
|
| 180 |
|