Spaces:
Runtime error
Runtime error
Commit
·
4a1afd8
1
Parent(s):
350784c
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@
|
|
| 2 |
|
| 3 |
|
| 4 |
# TODO save & restart from (if it exists) dataframe parquet
|
| 5 |
-
# TODO is spaces GPU blocking? Seems significantly slower while it's generating new in background
|
| 6 |
import torch
|
| 7 |
|
| 8 |
# lol
|
|
@@ -164,14 +163,9 @@ def generate(in_im_embs):
|
|
| 164 |
|
| 165 |
#######################
|
| 166 |
|
| 167 |
-
# TODO add to state instead of shared across all
|
| 168 |
-
glob_idx = 0
|
| 169 |
|
| 170 |
-
# TODO
|
| 171 |
-
#
|
| 172 |
-
# We can drop by lowest user ratings to keep enough RAM available when we get too many rows.
|
| 173 |
-
# We can continuously update by who is most recently active in the background & server as we go, plucking using "has been seen" and similarity
|
| 174 |
-
# to user embeds
|
| 175 |
|
| 176 |
def get_user_emb(embs, ys):
|
| 177 |
# handle case where every instance of calibration videos is 'Neither' or 'Like' or 'Dislike'
|
|
@@ -247,10 +241,7 @@ def background_next_image():
|
|
| 247 |
time.sleep(.01)
|
| 248 |
print('all users have 8 or more rows left to rate')
|
| 249 |
|
| 250 |
-
|
| 251 |
-
# TODO set this to run such that it's on a per-user-in-the-db basis; we only want to be ~5 ahead of every user in the db
|
| 252 |
user_id_list = set(rated_rows['latest_user_to_rate'].to_list())
|
| 253 |
-
|
| 254 |
for uid in user_id_list:
|
| 255 |
rated_rows = prevs_df[[i[1]['user:rating'].get(uid, None) is not None for i in prevs_df.iterrows()]]
|
| 256 |
not_rated_rows = prevs_df[[i[1]['user:rating'].get(uid, None) is None for i in prevs_df.iterrows()]]
|
|
@@ -297,8 +288,6 @@ def pluck_embs_ys(user_id):
|
|
| 297 |
return embs, ys
|
| 298 |
|
| 299 |
def next_image(calibrate_prompts, user_id):
|
| 300 |
-
global glob_idx
|
| 301 |
-
glob_idx = glob_idx + 1
|
| 302 |
print(prevs_df)
|
| 303 |
|
| 304 |
with torch.no_grad():
|
|
@@ -476,7 +465,7 @@ Explore the latent space without text prompts based on your preferences. Learn m
|
|
| 476 |
<div style='text-align:center; font-size:14px'>Thanks to @multimodalart for their contributions to the demo, esp. the interface and @maxbittker for feedback.
|
| 477 |
</ div>''')
|
| 478 |
|
| 479 |
-
# TODO
|
| 480 |
log = logging.getLogger('log_here')
|
| 481 |
log.setLevel(logging.ERROR)
|
| 482 |
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
# TODO save & restart from (if it exists) dataframe parquet
|
|
|
|
| 5 |
import torch
|
| 6 |
|
| 7 |
# lol
|
|
|
|
| 163 |
|
| 164 |
#######################
|
| 165 |
|
|
|
|
|
|
|
| 166 |
|
| 167 |
+
# TODO only generate ~5 new images ahead from a specific user embedding. Do this by tracking a column of who's embedding it was and
|
| 168 |
+
# taking the intersection for unrated by that user and from that users' embedding. Then we keep styles less consistent for better variety.
|
|
|
|
|
|
|
|
|
|
| 169 |
|
| 170 |
def get_user_emb(embs, ys):
|
| 171 |
# handle case where every instance of calibration videos is 'Neither' or 'Like' or 'Dislike'
|
|
|
|
| 241 |
time.sleep(.01)
|
| 242 |
print('all users have 8 or more rows left to rate')
|
| 243 |
|
|
|
|
|
|
|
| 244 |
user_id_list = set(rated_rows['latest_user_to_rate'].to_list())
|
|
|
|
| 245 |
for uid in user_id_list:
|
| 246 |
rated_rows = prevs_df[[i[1]['user:rating'].get(uid, None) is not None for i in prevs_df.iterrows()]]
|
| 247 |
not_rated_rows = prevs_df[[i[1]['user:rating'].get(uid, None) is None for i in prevs_df.iterrows()]]
|
|
|
|
| 288 |
return embs, ys
|
| 289 |
|
| 290 |
def next_image(calibrate_prompts, user_id):
|
|
|
|
|
|
|
| 291 |
print(prevs_df)
|
| 292 |
|
| 293 |
with torch.no_grad():
|
|
|
|
| 465 |
<div style='text-align:center; font-size:14px'>Thanks to @multimodalart for their contributions to the demo, esp. the interface and @maxbittker for feedback.
|
| 466 |
</ div>''')
|
| 467 |
|
| 468 |
+
# TODO quiet logging
|
| 469 |
log = logging.getLogger('log_here')
|
| 470 |
log.setLevel(logging.ERROR)
|
| 471 |
|