lixiang46 commited on
Commit
a9ba2aa
1 Parent(s): 68b15ec
Files changed (1) hide show
  1. app.py +4 -21
app.py CHANGED
@@ -21,9 +21,8 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
21
 
22
  url = "https://" + os.environ['tryon_url']
23
  token = os.environ['token']
24
- cookie = os.environ['Cookie']
25
 
26
- headers = {'Content-Type': 'application/json', 'token': token, 'Cookie': cookie}
27
  data = {
28
  "clothImage": encoded_garment_img,
29
  "humanImage": encoded_person_img,
@@ -45,7 +44,7 @@ def start_tryon(person_img, garment_img, seed, randomize_seed):
45
  else:
46
  info = "Try again latter"
47
  else:
48
- info = "URL error"
49
 
50
  return result_img, seed, info
51
 
@@ -74,7 +73,7 @@ css="""
74
  }
75
  #col-showcase {
76
  margin: 0 auto;
77
- max-width: 1000px;
78
  }
79
  #button {
80
  color: blue;
@@ -135,32 +134,16 @@ with gr.Blocks(css=css) as Tryon:
135
  </div>
136
  """)
137
  with gr.Column(elem_id = "col-showcase"):
138
- with gr.Row():
139
- image1 = gr.Image(label="Model", scale=1, value="assets/examples/model1.png", show_share_button=False, type="numpy", sources='upload')
140
- image2 = gr.Image(label="Garment", scale=1, value="assets/examples/garment1.png", show_share_button=False, type="numpy", sources='upload')
141
- image3 = gr.Image(label="Result", scale=1, value="assets/examples/result1.png", show_share_button=False, type="numpy", sources='upload')
142
  show_case = gr.Examples(
143
  examples=[
144
  ["assets/examples/model1.png", "assets/examples/garment1.png", "assets/examples/result1.png"],
145
  ["assets/examples/model2.png", "assets/examples/garment2.png", "assets/examples/result2.png"],
146
  ["assets/examples/model3.png", "assets/examples/garment3.png", "assets/examples/result3.png"],
147
  ],
148
- inputs=[image1, image2, image3],
149
  label=None
150
  )
151
 
152
-
153
- image1.change(
154
- fn = change_imgs,
155
- inputs = [image1, image2],
156
- outputs = [imgs, garm_img]
157
- ).then(
158
- fn = start_tryon,
159
- inputs=[image1, image2, seed, randomize_seed],
160
- outputs=[image_out, seed_used, result_info]
161
- )
162
-
163
-
164
  ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
165
  print("ip address", ip)
166
  Tryon.queue(max_size=10).launch()
 
21
 
22
  url = "https://" + os.environ['tryon_url']
23
  token = os.environ['token']
 
24
 
25
+ headers = {'Content-Type': 'application/json', 'token': token}
26
  data = {
27
  "clothImage": encoded_garment_img,
28
  "humanImage": encoded_person_img,
 
44
  else:
45
  info = "Try again latter"
46
  else:
47
+ info = "URL error, pleace contact the admin"
48
 
49
  return result_img, seed, info
50
 
 
73
  }
74
  #col-showcase {
75
  margin: 0 auto;
76
+ max-width: 1100px;
77
  }
78
  #button {
79
  color: blue;
 
134
  </div>
135
  """)
136
  with gr.Column(elem_id = "col-showcase"):
 
 
 
 
137
  show_case = gr.Examples(
138
  examples=[
139
  ["assets/examples/model1.png", "assets/examples/garment1.png", "assets/examples/result1.png"],
140
  ["assets/examples/model2.png", "assets/examples/garment2.png", "assets/examples/result2.png"],
141
  ["assets/examples/model3.png", "assets/examples/garment3.png", "assets/examples/result3.png"],
142
  ],
143
+ inputs=[imgs, garm_img, image_out],
144
  label=None
145
  )
146
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
148
  print("ip address", ip)
149
  Tryon.queue(max_size=10).launch()