Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
why not working
#45
by
gurjotxsingh2003
- opened
- README.md +2 -3
- app.py +7 -8
- assets/human/000.png +2 -2
- assets/human/001.png +2 -2
- assets/human/002.png +2 -2
- assets/human/003.png +2 -2
- assets/title.md +2 -2
README.md
CHANGED
@@ -4,11 +4,10 @@ emoji: π
|
|
4 |
colorFrom: purple
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: true
|
10 |
license: apache-2.0
|
11 |
-
disable_embedding: true
|
12 |
---
|
13 |
|
14 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
4 |
colorFrom: purple
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.38.1
|
8 |
app_file: app.py
|
9 |
pinned: true
|
10 |
license: apache-2.0
|
|
|
11 |
---
|
12 |
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -12,7 +12,6 @@ import time
|
|
12 |
def tryon(person_img, garment_img, seed, randomize_seed):
|
13 |
post_start_time = time.time()
|
14 |
if person_img is None or garment_img is None:
|
15 |
-
gr.Warning("Empty image")
|
16 |
return None, None, "Empty image"
|
17 |
if randomize_seed:
|
18 |
seed = random.randint(0, MAX_SEED)
|
@@ -48,7 +47,7 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
48 |
|
49 |
get_start_time =time.time()
|
50 |
time.sleep(9)
|
51 |
-
Max_Retry =
|
52 |
result_img = None
|
53 |
info = ""
|
54 |
err_log = ""
|
@@ -70,15 +69,13 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
70 |
elif status == "error":
|
71 |
err_log = f"Status is Error"
|
72 |
info = "Error"
|
73 |
-
break
|
74 |
else:
|
75 |
# print(response.text)
|
76 |
err_log = "URL error, pleace contact the admin"
|
77 |
info = "URL error, pleace contact the admin"
|
78 |
-
break
|
79 |
except requests.exceptions.ReadTimeout:
|
80 |
err_log = "Http Timeout"
|
81 |
-
info = "
|
82 |
except Exception as err:
|
83 |
err_log = f"Get Exception Error: {err}"
|
84 |
time.sleep(1)
|
@@ -90,7 +87,7 @@ def tryon(person_img, garment_img, seed, randomize_seed):
|
|
90 |
info = "Too many users, please try again later"
|
91 |
if info != "Success":
|
92 |
print(f"Error Log: {err_log}")
|
93 |
-
gr.
|
94 |
|
95 |
return result_img, seed, info
|
96 |
|
@@ -250,7 +247,7 @@ with gr.Blocks(css=css) as Tryon:
|
|
250 |
|
251 |
|
252 |
# try_button.click(fn=start_tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name='tryon',concurrency_limit=10)
|
253 |
-
test_button.click(fn=tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name=
|
254 |
|
255 |
with gr.Column(elem_id = "col-showcase"):
|
256 |
gr.HTML("""
|
@@ -272,4 +269,6 @@ with gr.Blocks(css=css) as Tryon:
|
|
272 |
label=None
|
273 |
)
|
274 |
|
275 |
-
|
|
|
|
|
|
12 |
def tryon(person_img, garment_img, seed, randomize_seed):
|
13 |
post_start_time = time.time()
|
14 |
if person_img is None or garment_img is None:
|
|
|
15 |
return None, None, "Empty image"
|
16 |
if randomize_seed:
|
17 |
seed = random.randint(0, MAX_SEED)
|
|
|
47 |
|
48 |
get_start_time =time.time()
|
49 |
time.sleep(9)
|
50 |
+
Max_Retry = 10
|
51 |
result_img = None
|
52 |
info = ""
|
53 |
err_log = ""
|
|
|
69 |
elif status == "error":
|
70 |
err_log = f"Status is Error"
|
71 |
info = "Error"
|
|
|
72 |
else:
|
73 |
# print(response.text)
|
74 |
err_log = "URL error, pleace contact the admin"
|
75 |
info = "URL error, pleace contact the admin"
|
|
|
76 |
except requests.exceptions.ReadTimeout:
|
77 |
err_log = "Http Timeout"
|
78 |
+
info = "Too many users, please try again later"
|
79 |
except Exception as err:
|
80 |
err_log = f"Get Exception Error: {err}"
|
81 |
time.sleep(1)
|
|
|
87 |
info = "Too many users, please try again later"
|
88 |
if info != "Success":
|
89 |
print(f"Error Log: {err_log}")
|
90 |
+
raise gr.Error("Too many users, please try again later")
|
91 |
|
92 |
return result_img, seed, info
|
93 |
|
|
|
247 |
|
248 |
|
249 |
# try_button.click(fn=start_tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name='tryon',concurrency_limit=10)
|
250 |
+
test_button.click(fn=tryon, inputs=[imgs, garm_img, seed, randomize_seed], outputs=[image_out, seed_used, result_info], api_name='tryon', concurrency_limit=45)
|
251 |
|
252 |
with gr.Column(elem_id = "col-showcase"):
|
253 |
gr.HTML("""
|
|
|
269 |
label=None
|
270 |
)
|
271 |
|
272 |
+
# ip = requests.get('http://ifconfig.me/ip', timeout=1).text.strip()
|
273 |
+
# print("ip address", ip)
|
274 |
+
Tryon.launch()
|
assets/human/000.png
CHANGED
Git LFS Details
|
Git LFS Details
|
assets/human/001.png
CHANGED
Git LFS Details
|
Git LFS Details
|
assets/human/002.png
CHANGED
Git LFS Details
|
Git LFS Details
|
assets/human/003.png
CHANGED
Git LFS Details
|
Git LFS Details
|
assets/title.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c9c071c86fdb5c23e62feb6f68dc7c537c7cfe67fd5fa2c66a263be3b47e0fb0
|
3 |
+
size 633
|