Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -44,6 +44,8 @@ from refiners.foundationals.latent_diffusion.stable_diffusion_1.multi_upscaler i
|
|
44 |
)
|
45 |
from datetime import datetime
|
46 |
|
|
|
|
|
47 |
model = T5ForConditionalGeneration.from_pretrained("t5-base")
|
48 |
tokenizer = T5Tokenizer.from_pretrained("t5-base")
|
49 |
|
@@ -654,7 +656,16 @@ def add_song_cover_text(img,artist,song,height,width):
|
|
654 |
|
655 |
spaces.GPU(300)
|
656 |
def upscale_image(img,factor):
|
657 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
|
659 |
def all_pipes(pos,neg,artist,song):
|
660 |
|
@@ -1280,7 +1291,12 @@ def translate(txt,to_lang="en",from_lang="auto"):
|
|
1280 |
def handle_generation(artist,song,lyrics,height,width):
|
1281 |
|
1282 |
log(f'CALL handle_generate')
|
1283 |
-
|
|
|
|
|
|
|
|
|
|
|
1284 |
pos_artist = re.sub(r"([ \t]){1,}", " ", artist).upper().strip()
|
1285 |
|
1286 |
pos_song = re.sub(r"([ \t]){1,}", " ", song).lower().strip()
|
@@ -1315,6 +1331,8 @@ def handle_generation(artist,song,lyrics,height,width):
|
|
1315 |
name = f'{generate_random_string(8)}.png'
|
1316 |
labeled_img.save(name)
|
1317 |
|
|
|
|
|
1318 |
# return names
|
1319 |
return name
|
1320 |
|
|
|
44 |
)
|
45 |
from datetime import datetime
|
46 |
|
47 |
+
working = False
|
48 |
+
|
49 |
model = T5ForConditionalGeneration.from_pretrained("t5-base")
|
50 |
tokenizer = T5Tokenizer.from_pretrained("t5-base")
|
51 |
|
|
|
656 |
|
657 |
spaces.GPU(300)
|
658 |
def upscale_image(img,factor):
|
659 |
+
if working:
|
660 |
+
return
|
661 |
+
|
662 |
+
working = True
|
663 |
+
|
664 |
+
ret = upscaler(img,upscale_factor=factor)
|
665 |
+
|
666 |
+
working = False
|
667 |
+
|
668 |
+
return ret
|
669 |
|
670 |
def all_pipes(pos,neg,artist,song):
|
671 |
|
|
|
1291 |
def handle_generation(artist,song,lyrics,height,width):
|
1292 |
|
1293 |
log(f'CALL handle_generate')
|
1294 |
+
|
1295 |
+
if working:
|
1296 |
+
return
|
1297 |
+
|
1298 |
+
working = True
|
1299 |
+
|
1300 |
pos_artist = re.sub(r"([ \t]){1,}", " ", artist).upper().strip()
|
1301 |
|
1302 |
pos_song = re.sub(r"([ \t]){1,}", " ", song).lower().strip()
|
|
|
1331 |
name = f'{generate_random_string(8)}.png'
|
1332 |
labeled_img.save(name)
|
1333 |
|
1334 |
+
working = False
|
1335 |
+
|
1336 |
# return names
|
1337 |
return name
|
1338 |
|