Spaces:
Running
Running
selfitcamera
commited on
Commit
·
6778dec
1
Parent(s):
7eafce0
init
Browse files
app.py
CHANGED
@@ -59,7 +59,7 @@ def onClick(cloth_image, pose_image, size):
|
|
59 |
return None, "fail to public you task", ""
|
60 |
|
61 |
max_try = 100
|
62 |
-
wait_s = 1
|
63 |
for i in range(max_try):
|
64 |
time.sleep(wait_s)
|
65 |
state = getInfRes(ApiUrl, OpenId, ApiKey, client_ip, timeId)
|
@@ -108,8 +108,8 @@ def onLoad(request: gr.Request):
|
|
108 |
if fail_n>0:
|
109 |
info = info+" Please upload a half/full-body human image, not just a clothing image!!!"
|
110 |
if queue_n>0:
|
111 |
-
info = info+" Wait for
|
112 |
-
|
113 |
except Exception as e:
|
114 |
print(e)
|
115 |
his_datas = his_datas + [info]
|
@@ -149,8 +149,13 @@ with gr.Blocks() as demo:
|
|
149 |
|
150 |
with gr.Tab('history'):
|
151 |
|
152 |
-
with gr.Row():
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
with gr.Row():
|
156 |
his_pose_image1 = gr.HTML()
|
@@ -175,6 +180,11 @@ with gr.Blocks() as demo:
|
|
175 |
run_button.click(fn=onClick, inputs=[cloth_image, pose_image, size_slider],
|
176 |
outputs=[res_image, info_text, MK01])
|
177 |
|
|
|
|
|
|
|
|
|
|
|
178 |
demo.load(onLoad, inputs=[], outputs=[his_pose_image1, his_res_image1,
|
179 |
his_pose_image2, his_res_image2, his_pose_image3, his_res_image3,
|
180 |
his_pose_image4, his_res_image4, his_pose_image5, his_res_image5,
|
|
|
59 |
return None, "fail to public you task", ""
|
60 |
|
61 |
max_try = 100
|
62 |
+
wait_s = 1.5
|
63 |
for i in range(max_try):
|
64 |
time.sleep(wait_s)
|
65 |
state = getInfRes(ApiUrl, OpenId, ApiKey, client_ip, timeId)
|
|
|
108 |
if fail_n>0:
|
109 |
info = info+" Please upload a half/full-body human image, not just a clothing image!!!"
|
110 |
if queue_n>0:
|
111 |
+
info = info+" Wait for 20s and refresh this page, successed results will display in the history tab at the bottom"
|
112 |
+
|
113 |
except Exception as e:
|
114 |
print(e)
|
115 |
his_datas = his_datas + [info]
|
|
|
149 |
|
150 |
with gr.Tab('history'):
|
151 |
|
152 |
+
with gr.Row(): # 用 Row 包裹按钮
|
153 |
+
with gr.Column(scale=0.5): # Button 占用 Row 的一半
|
154 |
+
refresh_button = gr.Button("Refresh History", size="small")
|
155 |
+
MK02 = gr.Markdown(value="") # 示例 Markdown 内容
|
156 |
+
|
157 |
+
# with gr.Row():
|
158 |
+
# MK02 = gr.Markdown()
|
159 |
|
160 |
with gr.Row():
|
161 |
his_pose_image1 = gr.HTML()
|
|
|
180 |
run_button.click(fn=onClick, inputs=[cloth_image, pose_image, size_slider],
|
181 |
outputs=[res_image, info_text, MK01])
|
182 |
|
183 |
+
refresh_button.click(fn=onLoad, inputs=[], outputs=[his_pose_image1, his_res_image1,
|
184 |
+
his_pose_image2, his_res_image2, his_pose_image3, his_res_image3,
|
185 |
+
his_pose_image4, his_res_image4, his_pose_image5, his_res_image5,
|
186 |
+
MK02])
|
187 |
+
|
188 |
demo.load(onLoad, inputs=[], outputs=[his_pose_image1, his_res_image1,
|
189 |
his_pose_image2, his_res_image2, his_pose_image3, his_res_image3,
|
190 |
his_pose_image4, his_res_image4, his_pose_image5, his_res_image5,
|