Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,27 +30,27 @@ def prompt(pos,hei,wid,no):
|
|
| 30 |
a=a['run_id']
|
| 31 |
id.append(a)
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
|
| 40 |
-
for i in id :
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
return urls
|
| 55 |
|
| 56 |
|
|
|
|
| 30 |
a=a['run_id']
|
| 31 |
id.append(a)
|
| 32 |
|
| 33 |
+
futures = []
|
| 34 |
+
with concurrent.futures.ThreadPoolExecutor() as executor:
|
| 35 |
+
for url in range(no):
|
| 36 |
+
futures.append(executor.submit(gen))
|
| 37 |
+
for future in concurrent.futures.as_completed(futures):
|
| 38 |
+
print(future)
|
| 39 |
|
| 40 |
+
for i in id :
|
| 41 |
+
li = requests.get(f"https://www.comfydeploy.com/api/run?run_id={i}",headers=hed)
|
| 42 |
+
lo=li.json()
|
| 43 |
+
url=lo['outputs']
|
| 44 |
+
while url ==[]:
|
| 45 |
+
li = requests.get(f"https://www.comfydeploy.com/api/run?run_id={i}",headers=hed)
|
| 46 |
+
lo=li.json()
|
| 47 |
+
url =lo['outputs']
|
| 48 |
+
while 'url' not in url:
|
| 49 |
+
li = requests.get(f"https://www.comfydeploy.com/api/run?run_id={i}",headers=hed)
|
| 50 |
+
lo=li.json()
|
| 51 |
+
url=lo['outputs'][0]['data']['images'][0]
|
| 52 |
+
url=url['url']
|
| 53 |
+
urls.append(url)
|
| 54 |
return urls
|
| 55 |
|
| 56 |
|