Spaces:
Running
Running
Upload app.py
#162
by
ali2780
- opened
app.py
CHANGED
@@ -1,191 +1,325 @@
|
|
1 |
-
import os
|
2 |
-
import cv2
|
3 |
-
import numpy as np
|
4 |
-
import json
|
5 |
-
import random
|
6 |
-
from PIL import Image, ImageDraw, ImageFont
|
7 |
-
import asyncio
|
8 |
-
|
9 |
-
import requests
|
10 |
-
import base64
|
11 |
-
import gradio as gr
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
with gr.Blocks(css
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
)
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import os
|
2 |
+
# import cv2
|
3 |
+
# import numpy as np
|
4 |
+
# import json
|
5 |
+
# import random
|
6 |
+
# from PIL import Image, ImageDraw, ImageFont
|
7 |
+
# import asyncio
|
8 |
+
|
9 |
+
# import requests
|
10 |
+
# import base64
|
11 |
+
# import gradio as gr
|
12 |
+
|
13 |
+
# machine_number = 0
|
14 |
+
# model = os.path.join(os.path.dirname(__file__), "models/eva/Eva_0.png")
|
15 |
+
|
16 |
+
# MODEL_MAP = {
|
17 |
+
# "AI Model Rouyan_0": 'models/rouyan_new/Rouyan_0.png',
|
18 |
+
# "AI Model Rouyan_1": 'models/rouyan_new/Rouyan_1.png',
|
19 |
+
# "AI Model Rouyan_2": 'models/rouyan_new/Rouyan_2.png',
|
20 |
+
# "AI Model Eva_0": 'models/eva/Eva_0.png',
|
21 |
+
# "AI Model Eva_1": 'models/eva/Eva_1.png',
|
22 |
+
# "AI Model Simon_0": 'models/simon_online/Simon_0.png',
|
23 |
+
# "AI Model Simon_1": 'models/simon_online/Simon_1.png',
|
24 |
+
# "AI Model Xuanxuan_0": 'models/xiaoxuan_online/Xuanxuan_0.png',
|
25 |
+
# "AI Model Xuanxuan_1": 'models/xiaoxuan_online/Xuanxuan_1.png',
|
26 |
+
# "AI Model Xuanxuan_2": 'models/xiaoxuan_online/Xuanxuan_2.png',
|
27 |
+
# "AI Model Yaqi_0": 'models/yaqi/Yaqi_0.png',
|
28 |
+
# "AI Model Yaqi_1": 'models/yaqi/Yaqi_1.png',
|
29 |
+
# "AI Model Yaqi_2": 'models/yaqi/Yaqi_2.png',
|
30 |
+
# "AI Model Yaqi_3": 'models/yaqi/Yaqi_3.png',
|
31 |
+
# "AI Model Yifeng_0": 'models/yifeng_online/Yifeng_0.png',
|
32 |
+
# "AI Model Yifeng_1": 'models/yifeng_online/Yifeng_1.png',
|
33 |
+
# "AI Model Yifeng_2": 'models/yifeng_online/Yifeng_2.png',
|
34 |
+
# "AI Model Yifeng_3": 'models/yifeng_online/Yifeng_3.png',
|
35 |
+
# }
|
36 |
+
|
37 |
+
# def add_waterprint(img):
|
38 |
+
# h, w, _ = img.shape
|
39 |
+
# img = cv2.putText(img, 'Powered by OutfitAnyone', (int(0.3*w), h-20), cv2.FONT_HERSHEY_PLAIN, 2, (128, 128, 128), 2, cv2.LINE_AA)
|
40 |
+
# return img
|
41 |
+
|
42 |
+
# def get_tryon_result(model_name, garment1, garment2, seed=1234):
|
43 |
+
# model_name = "AI Model " + model_name.split("/")[-1].split(".")[0] # Linux path handling
|
44 |
+
# print(model_name)
|
45 |
+
|
46 |
+
# # Directly load the model image from the disk, no need for Gradio file upload
|
47 |
+
# model_image = cv2.imread(MODEL_MAP.get(model_name)) # Load model image from disk
|
48 |
+
# if model_image is None:
|
49 |
+
# raise ValueError(f"Model image {model_name} could not be loaded.")
|
50 |
+
|
51 |
+
# encoded_garment1 = cv2.imencode('.jpg', garment1)[1].tobytes()
|
52 |
+
# encoded_garment1 = base64.b64encode(encoded_garment1).decode('utf-8')
|
53 |
+
|
54 |
+
# if garment2 is not None:
|
55 |
+
# encoded_garment2 = cv2.imencode('.jpg', garment2)[1].tobytes()
|
56 |
+
# encoded_garment2 = base64.b64encode(encoded_garment2).decode('utf-8')
|
57 |
+
# else:
|
58 |
+
# encoded_garment2 = ''
|
59 |
+
|
60 |
+
# # Get the IP address from environment variable or default to localhost
|
61 |
+
# url = os.environ.get('OA_IP_ADDRESS', 'http://localhost:5000')
|
62 |
+
# headers = {'Content-Type': 'application/json'}
|
63 |
+
# seed = random.randint(0, 1222222222)
|
64 |
+
|
65 |
+
# data = {
|
66 |
+
# "garment1": encoded_garment1,
|
67 |
+
# "garment2": encoded_garment2,
|
68 |
+
# "model_name": model_name,
|
69 |
+
# "seed": seed
|
70 |
+
# }
|
71 |
+
|
72 |
+
# response = requests.post(url, headers=headers, data=json.dumps(data))
|
73 |
+
# print("response code", response.status_code)
|
74 |
+
|
75 |
+
# if response.status_code == 200:
|
76 |
+
# result = response.json()
|
77 |
+
# result = base64.b64decode(result['images'][0])
|
78 |
+
# result_np = np.frombuffer(result, np.uint8)
|
79 |
+
# result_img = cv2.imdecode(result_np, cv2.IMREAD_UNCHANGED)
|
80 |
+
# else:
|
81 |
+
# print('Server error!')
|
82 |
+
|
83 |
+
# final_img = add_waterprint(result_img)
|
84 |
+
|
85 |
+
# return final_img
|
86 |
+
|
87 |
+
# with gr.Blocks(css=".output-image, .input-image, .image-preview {height: 400px !important}") as demo:
|
88 |
+
# gr.HTML(
|
89 |
+
# """
|
90 |
+
# <div style="display: flex; justify-content: center; align-items: center; text-align: center;">
|
91 |
+
# <div>
|
92 |
+
# <h1>Outfit Anyone: Ultra-high quality virtual try-on for Any Clothing and Any Person</h1>
|
93 |
+
# <h4>v0.9</h4>
|
94 |
+
# <h5>If you like our project, please give us a star on Github to stay updated with the latest developments.</h5>
|
95 |
+
# <div style="display: flex; justify-content: center; align-items: center; text-align: center;">
|
96 |
+
# <a href="https://arxiv.org/abs/2407.16224"><img src="https://img.shields.io/badge/Arxiv-2407.16224-red"></a>
|
97 |
+
# <a href='https://humanaigc.github.io/outfit-anyone/'><img src='https://img.shields.io/badge/Project_Page-OutfitAnyone-green' alt='Project Page'></a>
|
98 |
+
# <a href='https://github.com/HumanAIGC/OutfitAnyone'><img src='https://img.shields.io/badge/Github-Repo-blue'></a>
|
99 |
+
# </div>
|
100 |
+
# </div>
|
101 |
+
# </div>
|
102 |
+
# """
|
103 |
+
# )
|
104 |
+
|
105 |
+
# with gr.Row():
|
106 |
+
# with gr.Column():
|
107 |
+
# init_image = gr.Image(sources='upload', type="numpy", label="model", value=None)
|
108 |
+
# example = gr.Examples(inputs=init_image,
|
109 |
+
# examples_per_page=4,
|
110 |
+
# examples=[os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Rouyan_0'))])
|
111 |
+
# with gr.Column():
|
112 |
+
# gr.HTML(
|
113 |
+
# """
|
114 |
+
# <div style="display: flex; justify-content: center; align-items: center; text-align: center;">
|
115 |
+
# <div>
|
116 |
+
# <h3>Models are fixed and cannot be uploaded or modified; we only support users uploading their own garments.</h3>
|
117 |
+
# <h4 style="margin: 0;">For a one-piece dress or coat, you only need to upload the image to the 'top garment' section and leave the 'lower garment' section empty.</h4>
|
118 |
+
# </div>
|
119 |
+
# </div>
|
120 |
+
# """
|
121 |
+
# )
|
122 |
+
# with gr.Row():
|
123 |
+
# garment_top = gr.Image(sources='upload', type="numpy", label="top garment")
|
124 |
+
# example_top = gr.Examples(inputs=garment_top,
|
125 |
+
# examples_per_page=5,
|
126 |
+
# examples=[os.path.join(os.path.dirname(__file__), "garments/top222.JPG")])
|
127 |
+
# garment_down = gr.Image(sources='upload', type="numpy", label="lower garment")
|
128 |
+
# example_down = gr.Examples(inputs=garment_down,
|
129 |
+
# examples_per_page=5,
|
130 |
+
# examples=[os.path.join(os.path.dirname(__file__), "garments/bottom1.png")])
|
131 |
+
|
132 |
+
# run_button = gr.Button(value="Run")
|
133 |
+
# with gr.Column():
|
134 |
+
# gallery = gr.Image()
|
135 |
+
|
136 |
+
# run_button.click(fn=get_tryon_result,
|
137 |
+
# inputs=[init_image, garment_top, garment_down],
|
138 |
+
# outputs=[gallery],
|
139 |
+
# concurrency_limit=2)
|
140 |
+
|
141 |
+
# gr.Markdown("## Examples")
|
142 |
+
# with gr.Row():
|
143 |
+
# reference_image1 = gr.Image(label="model", scale=1, value="examples/basemodel.png")
|
144 |
+
# reference_image2 = gr.Image(label="garment", scale=1, value="examples/garment1.jpg")
|
145 |
+
# reference_image3 = gr.Image(label="result", scale=1, value="examples/result1.png")
|
146 |
+
# gr.Examples(
|
147 |
+
# examples=[["examples/basemodel.png", "examples/garment1.png", "examples/result1.png"]],
|
148 |
+
# inputs=[reference_image1, reference_image2, reference_image3],
|
149 |
+
# label=None,
|
150 |
+
# )
|
151 |
+
|
152 |
+
# if __name__ == "__main__":
|
153 |
+
# ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
|
154 |
+
# print("IP address", ip)
|
155 |
+
# demo.queue(max_size=10)
|
156 |
+
# demo.launch()
|
157 |
+
|
158 |
+
|
159 |
+
import os
|
160 |
+
import cv2
|
161 |
+
import numpy as np
|
162 |
+
import json
|
163 |
+
import random
|
164 |
+
from PIL import Image, ImageDraw, ImageFont
|
165 |
+
import asyncio
|
166 |
+
|
167 |
+
import requests
|
168 |
+
import base64
|
169 |
+
import gradio as gr
|
170 |
+
|
171 |
+
# Set the machine number and model path
|
172 |
+
machine_number = 0
|
173 |
+
model = os.path.join(os.path.dirname(__file__), "models", "eva", "Eva_0.png")
|
174 |
+
|
175 |
+
# Define a mapping of model names to file paths
|
176 |
+
MODEL_MAP = {
|
177 |
+
"AI Model Rouyan_0": os.path.join("models", "rouyan_new", "rouyan_new\\Rouyan_0.png"),
|
178 |
+
"AI Model Rouyan_1": os.path.join("models", "rouyan_new", "rouyan_new\\Rouyan_1.png"),
|
179 |
+
"AI Model Rouyan_2": os.path.join("models", "rouyan_new", "rouyan_new\\Rouyan_2.png"),
|
180 |
+
"AI Model Eva_0": os.path.join("models", "eva", "Eva_0.png"),
|
181 |
+
"AI Model Eva_1": os.path.join("models", "eva", "Eva_1.png"),
|
182 |
+
"AI Model Simon_0": os.path.join("models", "simon_online", "Simon_0.png"),
|
183 |
+
"AI Model Simon_1": os.path.join("models", "simon_online", "Simon_1.png"),
|
184 |
+
"AI Model Xuanxuan_0": os.path.join("models", "xiaoxuan_online", "Xuanxuan_0.png"),
|
185 |
+
"AI Model Xuanxuan_1": os.path.join("models", "xiaoxuan_online", "Xuanxuan_1.png"),
|
186 |
+
"AI Model Xuanxuan_2": os.path.join("models", "xiaoxuan_online", "Xuanxuan_2.png"),
|
187 |
+
"AI Model Yaqi_0": os.path.join("models", "yaqi", "Yaqi_0.png"),
|
188 |
+
"AI Model Yaqi_1": os.path.join("models", "yaqi", "Yaqi_1.png"),
|
189 |
+
"AI Model Yaqi_2": os.path.join("models", "yaqi", "Yaqi_2.png"),
|
190 |
+
"AI Model Yaqi_3": os.path.join("models", "yaqi", "Yaqi_3.png"),
|
191 |
+
"AI Model Yifeng_0": os.path.join("models", "yifeng_online", "Yifeng_0.png"),
|
192 |
+
"AI Model Yifeng_1": os.path.join("models", "yifeng_online", "Yifeng_1.png"),
|
193 |
+
"AI Model Yifeng_2": os.path.join("models", "yifeng_online", "Yifeng_2.png"),
|
194 |
+
"AI Model Yifeng_3": os.path.join("models", "yifeng_online", "Yifeng_3.png"),
|
195 |
+
}
|
196 |
+
|
197 |
+
# Function to add watermark text to image
|
198 |
+
def add_waterprint(img):
|
199 |
+
h, w, _ = img.shape
|
200 |
+
img = cv2.putText(img, 'Powered by OutfitAnyone', (int(0.3*w), h-20), cv2.FONT_HERSHEY_PLAIN, 2, (128, 128, 128), 2, cv2.LINE_AA)
|
201 |
+
return img
|
202 |
+
|
203 |
+
# Function to process try-on results
|
204 |
+
def get_tryon_result(model_name, garment1, garment2, seed=1234):
|
205 |
+
if isinstance(model_name, np.ndarray):
|
206 |
+
model_name = model_name[0]
|
207 |
+
|
208 |
+
model_name = "AI Model " + model_name.split("\\")[-1].split(".")[0] # Handle Windows path
|
209 |
+
print(type(model_name))
|
210 |
+
|
211 |
+
|
212 |
+
# Directly load the model image from the disk, no need for Gradio file upload
|
213 |
+
model_image = cv2.imread(MODEL_MAP.get(model_name)) # Load model image from disk
|
214 |
+
if model_image is None:
|
215 |
+
raise ValueError(f"Model image {model_name} could not be loaded.")
|
216 |
+
|
217 |
+
# Encode garments as base64
|
218 |
+
encoded_garment1 = cv2.imencode('.jpg', garment1)[1].tobytes()
|
219 |
+
encoded_garment1 = base64.b64encode(encoded_garment1).decode('utf-8')
|
220 |
+
|
221 |
+
if garment2 is not None:
|
222 |
+
encoded_garment2 = cv2.imencode('.jpg', garment2)[1].tobytes()
|
223 |
+
encoded_garment2 = base64.b64encode(encoded_garment2).decode('utf-8')
|
224 |
+
else:
|
225 |
+
encoded_garment2 = ''
|
226 |
+
|
227 |
+
# Get the IP address from environment variable or default to localhost
|
228 |
+
url = os.environ.get('OA_IP_ADDRESS', 'http://localhost:5000')
|
229 |
+
headers = {'Content-Type': 'application/json'}
|
230 |
+
seed = random.randint(0, 1222222222)
|
231 |
+
|
232 |
+
# Prepare data for POST request
|
233 |
+
data = {
|
234 |
+
"garment1": encoded_garment1,
|
235 |
+
"garment2": encoded_garment2,
|
236 |
+
"model_name": model_name,
|
237 |
+
"seed": seed
|
238 |
+
}
|
239 |
+
|
240 |
+
# Send POST request to server
|
241 |
+
response = requests.post(url, headers=headers, data=json.dumps(data))
|
242 |
+
print("response code", response.status_code)
|
243 |
+
|
244 |
+
if response.status_code == 200:
|
245 |
+
result = response.json()
|
246 |
+
result = base64.b64decode(result['images'][0])
|
247 |
+
result_np = np.frombuffer(result, np.uint8)
|
248 |
+
result_img = cv2.imdecode(result_np, cv2.IMREAD_UNCHANGED)
|
249 |
+
else:
|
250 |
+
print('Server error!')
|
251 |
+
|
252 |
+
final_img = add_waterprint(result_img)
|
253 |
+
|
254 |
+
return final_img
|
255 |
+
|
256 |
+
|
257 |
+
with gr.Blocks(css=".output-image, .input-image, .image-preview {height: 400px !important}") as demo:
|
258 |
+
|
259 |
+
# Header Section
|
260 |
+
gr.HTML(
|
261 |
+
"""
|
262 |
+
<div style="text-align: center; padding: 20px;">
|
263 |
+
<h1 style="font-size: 2.5rem; color: #2c3e50;">Outfit Anyone</h1>
|
264 |
+
<h2 style="color: #34495e;">Ultra-high quality virtual try-on for any clothing and any person</h2>
|
265 |
+
</div>
|
266 |
+
"""
|
267 |
+
)
|
268 |
+
|
269 |
+
# UI Layout for Image Inputs and Text Description
|
270 |
+
with gr.Row():
|
271 |
+
with gr.Column():
|
272 |
+
gr.Markdown("### Upload Your Model Image")
|
273 |
+
init_image = gr.Image(sources='upload', type="numpy", label="Select a Model Image", value=None)
|
274 |
+
example = gr.Examples(inputs=init_image,
|
275 |
+
examples_per_page=4,
|
276 |
+
examples=[os.path.join(os.path.dirname(__file__), MODEL_MAP.get('AI Model Rouyan_0'))])
|
277 |
+
|
278 |
+
with gr.Column():
|
279 |
+
gr.Markdown(
|
280 |
+
"""
|
281 |
+
<h3 style="color: #2c3e50;">Instructions</h3>
|
282 |
+
<p style="font-size: 1.1rem; color: #7f8c8d;">Please upload your model image and garment images (top and bottom).
|
283 |
+
The models are pre-loaded and cannot be modified.
|
284 |
+
For a dress or coat, you only need to upload the image for the 'Top Garment' section and leave the 'Bottom Garment' section empty.</p>
|
285 |
+
"""
|
286 |
+
)
|
287 |
+
with gr.Row():
|
288 |
+
garment_top = gr.Image(sources='upload', type="numpy", label="Top Garment")
|
289 |
+
example_top = gr.Examples(inputs=garment_top,
|
290 |
+
examples_per_page=5,
|
291 |
+
examples=[os.path.join(os.path.dirname(__file__), "garments", "top222.JPG")])
|
292 |
+
|
293 |
+
garment_down = gr.Image(sources='upload', type="numpy", label="Bottom Garment")
|
294 |
+
example_down = gr.Examples(inputs=garment_down,
|
295 |
+
examples_per_page=5,
|
296 |
+
examples=[os.path.join(os.path.dirname(__file__), "garments", "bottom1.png")])
|
297 |
+
|
298 |
+
run_button = gr.Button(value="Run Try-On")
|
299 |
+
|
300 |
+
with gr.Column():
|
301 |
+
gallery = gr.Image(label="Try-On Result")
|
302 |
+
|
303 |
+
run_button.click(fn=get_tryon_result,
|
304 |
+
inputs=[init_image, garment_top, garment_down],
|
305 |
+
outputs=[gallery],
|
306 |
+
concurrency_limit=2)
|
307 |
+
|
308 |
+
# Example Section
|
309 |
+
gr.Markdown("## Example Try-On Results")
|
310 |
+
with gr.Row():
|
311 |
+
reference_image1 = gr.Image(label="Model Example", scale=1, value="examples\\examples_basemodel.png")
|
312 |
+
reference_image2 = gr.Image(label="Garment Example", scale=1, value="examples\\examples_garment1.jpg")
|
313 |
+
reference_image3 = gr.Image(label="Result Example", scale=1, value="examples\\examples_result1.png")
|
314 |
+
|
315 |
+
gr.Examples(
|
316 |
+
examples=[["examples\\examples_basemodel.png", "examples\\examples_garment1.png", "examples\\examples_result1.png"]],
|
317 |
+
inputs=[reference_image1, reference_image2, reference_image3],
|
318 |
+
label="Check out our example outfits!",
|
319 |
+
)
|
320 |
+
|
321 |
+
if __name__ == "__main__":
|
322 |
+
ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
|
323 |
+
print("IP address", ip)
|
324 |
+
demo.queue(max_size=10)
|
325 |
+
demo.launch()
|