Spaces:
Sleeping
Sleeping
Commit
•
93f11bd
1
Parent(s):
ba04c29
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,11 @@ import time
|
|
14 |
import replicate
|
15 |
import torch
|
16 |
import pickle
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
prompt_list = [p for p in list(set(
|
19 |
pd.read_csv('./twitter_prompts.csv').iloc[:, 1].tolist())) if type(p) == str]
|
@@ -56,8 +61,10 @@ def next_image():
|
|
56 |
"rynmurdock/zahir:0bf6ef3012f23397a6f31d4e4066ff9a13f028e54b119041cb82b0b38fdc6a36",
|
57 |
input={"prompt": prompt,}
|
58 |
)
|
|
|
|
|
59 |
|
60 |
-
embs.append(
|
61 |
return image
|
62 |
else:
|
63 |
print('######### Roaming #########')
|
@@ -94,7 +101,11 @@ def next_image():
|
|
94 |
"rynmurdock/zahir:0bf6ef3012f23397a6f31d4e4066ff9a13f028e54b119041cb82b0b38fdc6a36",
|
95 |
input={"prompt": prompt, 'im_emb': pickle.dumps(im_emb)}
|
96 |
)
|
|
|
|
|
|
|
97 |
|
|
|
98 |
embs.append(im_emb)
|
99 |
|
100 |
torch.save(lin_class.coef_, f'./{start_time}.pt')
|
|
|
14 |
import replicate
|
15 |
import torch
|
16 |
import pickle
|
17 |
+
from urllib.request import urlopen
|
18 |
+
|
19 |
+
from PIL import Image
|
20 |
+
import requests
|
21 |
+
from io import BytesIO
|
22 |
|
23 |
prompt_list = [p for p in list(set(
|
24 |
pd.read_csv('./twitter_prompts.csv').iloc[:, 1].tolist())) if type(p) == str]
|
|
|
61 |
"rynmurdock/zahir:0bf6ef3012f23397a6f31d4e4066ff9a13f028e54b119041cb82b0b38fdc6a36",
|
62 |
input={"prompt": prompt,}
|
63 |
)
|
64 |
+
response = requests.get(url)
|
65 |
+
image = Image.open(BytesIO(response.content))
|
66 |
|
67 |
+
embs.append(pickle.load(urlopen(pooled_embeim_embds, 'rb')))
|
68 |
return image
|
69 |
else:
|
70 |
print('######### Roaming #########')
|
|
|
101 |
"rynmurdock/zahir:0bf6ef3012f23397a6f31d4e4066ff9a13f028e54b119041cb82b0b38fdc6a36",
|
102 |
input={"prompt": prompt, 'im_emb': pickle.dumps(im_emb)}
|
103 |
)
|
104 |
+
response = requests.get(url)
|
105 |
+
image = Image.open(BytesIO(response.content))
|
106 |
+
|
107 |
|
108 |
+
im_emb = pickle.load(urlopen(im_emb, 'rb'))
|
109 |
embs.append(im_emb)
|
110 |
|
111 |
torch.save(lin_class.coef_, f'./{start_time}.pt')
|