File size: 806 Bytes
8ea8b32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import json, sys, threading, time, os
sys.path.insert(0, '/workspaces/studio')
import horde
items = json.load(open('/workspaces/studio/items.json'))
only = sys.argv[1].split(',')
seed = int(sys.argv[2])
os.makedirs('/tmp/work/zi', exist_ok=True)
def job(it):
    out = f"/tmp/work/zi/{it['id']}_{seed}.webp"
    for a in range(4):
        try:
            body_pp = True
            horde.gen_pp(it['prompt'] + ", shot on iPhone, vertical photo, authentic, sharp details", out, seed)
            return
        except Exception as e:
            print('err', it['id'], e, getattr(e, 'read', lambda: b'')()[:200], flush=True); time.sleep(20)
ts = []
for it in items:
    if it['id'] in only:
        t = threading.Thread(target=job, args=(it,)); t.start(); ts.append(t); time.sleep(2)
for t in ts: t.join()