jocoandonob commited on
Commit
ba01344
·
1 Parent(s): 4d2e566
Files changed (1) hide show
  1. app.py +29 -44
app.py CHANGED
@@ -132,47 +132,32 @@ def process_image(human_img_path, garm_img_path):
132
  return generated_image
133
 
134
 
135
- # Create the main interface
136
- with gr.Blocks() as demo:
137
- with gr.Tabs():
138
- with gr.TabItem("Virtual Try-On"):
139
- gr.HTML("<center><h1>Virtual Try-On</h1></center>")
140
- gr.HTML("<center><p>Upload an image of a person and an image of a garment ✨</p></center>")
141
- with gr.Row():
142
- with gr.Column():
143
- human_img = gr.Image(type="filepath", label='Human', interactive=True)
144
- example = gr.Examples(
145
- inputs=human_img,
146
- examples_per_page=10,
147
- examples=human_list_path
148
- )
149
-
150
- with gr.Column():
151
- garm_img = gr.Image(label="Garment", type="filepath", interactive=True)
152
- example = gr.Examples(
153
- inputs=garm_img,
154
- examples_per_page=8,
155
- examples=garm_list_path)
156
- with gr.Column():
157
- image_out = gr.Image(label="Processed image", type="pil")
158
-
159
- with gr.Row():
160
- try_button = gr.Button(value="Try-on", variant='primary')
161
-
162
- # Linking the button to the processing function
163
- try_button.click(fn=process_image, inputs=[human_img, garm_img], outputs=image_out)
164
-
165
- with gr.TabItem("Help"):
166
- gr.HTML("""
167
- <div style="text-align: center; padding: 20px;">
168
- <h1>Thank You!</h1>
169
- <p style="font-size: 18px; margin: 20px 0;">
170
- Thank you for using our Virtual Try-On application. We appreciate your support and hope you enjoy trying on different outfits virtually!
171
- </p>
172
- <p style="font-size: 16px; margin: 20px 0;">
173
- If you have any questions or need assistance, please don't hesitate to reach out to our support team.
174
- </p>
175
- </div>
176
- """)
177
-
178
- demo.launch(show_error=True)
 
132
  return generated_image
133
 
134
 
135
+ image_blocks = gr.Blocks().queue()
136
+ with image_blocks as demo:
137
+ gr.HTML("<center><h1>Virtual Try-On</h1></center>")
138
+ gr.HTML("<center><p>Upload an image of a person and an image of a garment ✨</p></center>")
139
+ with gr.Row():
140
+ with gr.Column():
141
+ human_img = gr.Image(type="filepath", label='Human', interactive=True)
142
+ example = gr.Examples(
143
+ inputs=human_img,
144
+ examples_per_page=10,
145
+ examples=human_list_path
146
+ )
147
+
148
+ with gr.Column():
149
+ garm_img = gr.Image(label="Garment", type="filepath", interactive=True)
150
+ example = gr.Examples(
151
+ inputs=garm_img,
152
+ examples_per_page=8,
153
+ examples=garm_list_path)
154
+ with gr.Column():
155
+ image_out = gr.Image(label="Processed image", type="pil")
156
+
157
+ with gr.Row():
158
+ try_button = gr.Button(value="Try-on", variant='primary')
159
+
160
+ # Linking the button to the processing function
161
+ try_button.click(fn=process_image, inputs=[human_img, garm_img], outputs=image_out)
162
+
163
+ image_blocks.launch(show_error=True)