Spaces:
Sleeping
Sleeping
rynmurdock
commited on
Commit
•
b96b83f
1
Parent(s):
2df7643
Update app.py
Browse files
app.py
CHANGED
@@ -57,14 +57,14 @@ def next_image():
|
|
57 |
prompt = calibrate_prompts.pop(0)
|
58 |
print(prompt)
|
59 |
|
60 |
-
|
61 |
"rynmurdock/zahir:49ebb1916c4baae35884ebfa16b092cf45d086c1913b53f62bb07d575cdbe683",
|
62 |
input={"prompt": prompt,}
|
63 |
)
|
64 |
-
response = requests.get(
|
65 |
image = Image.open(BytesIO(response.content))
|
66 |
|
67 |
-
embs.append(torch.tensor(urlopen(
|
68 |
return image
|
69 |
else:
|
70 |
print('######### Roaming #########')
|
@@ -97,15 +97,15 @@ def next_image():
|
|
97 |
prompt= 'an image' if glob_idx % 2 == 0 else rng_prompt
|
98 |
print(prompt)
|
99 |
|
100 |
-
|
101 |
"rynmurdock/zahir:49ebb1916c4baae35884ebfa16b092cf45d086c1913b53f62bb07d575cdbe683",
|
102 |
input={"prompt": prompt, 'im_emb': pickle.dumps(im_emb)}
|
103 |
)
|
104 |
-
response = requests.get(
|
105 |
image = Image.open(BytesIO(response.content))
|
106 |
|
107 |
|
108 |
-
im_emb = torch.tensor(urlopen(
|
109 |
embs.append(im_emb)
|
110 |
|
111 |
torch.save(lin_class.coef_, f'./{start_time}.pt')
|
|
|
57 |
prompt = calibrate_prompts.pop(0)
|
58 |
print(prompt)
|
59 |
|
60 |
+
output = replicate.run(
|
61 |
"rynmurdock/zahir:49ebb1916c4baae35884ebfa16b092cf45d086c1913b53f62bb07d575cdbe683",
|
62 |
input={"prompt": prompt,}
|
63 |
)
|
64 |
+
response = requests.get(output['file1'])
|
65 |
image = Image.open(BytesIO(response.content))
|
66 |
|
67 |
+
embs.append(torch.tensor(urlopen(output['file2']).read().decode('utf-8').split(', ')))
|
68 |
return image
|
69 |
else:
|
70 |
print('######### Roaming #########')
|
|
|
97 |
prompt= 'an image' if glob_idx % 2 == 0 else rng_prompt
|
98 |
print(prompt)
|
99 |
|
100 |
+
output = replicate.run(
|
101 |
"rynmurdock/zahir:49ebb1916c4baae35884ebfa16b092cf45d086c1913b53f62bb07d575cdbe683",
|
102 |
input={"prompt": prompt, 'im_emb': pickle.dumps(im_emb)}
|
103 |
)
|
104 |
+
response = requests.get(output['file1'])
|
105 |
image = Image.open(BytesIO(response.content))
|
106 |
|
107 |
|
108 |
+
im_emb = torch.tensor(urlopen(output['file2']).read().decode('utf-8').split(', '))
|
109 |
embs.append(im_emb)
|
110 |
|
111 |
torch.save(lin_class.coef_, f'./{start_time}.pt')
|