Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -512,8 +512,7 @@ function custom(){
|
|
512 |
|
513 |
# torch pipes
|
514 |
|
515 |
-
|
516 |
-
image_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=dtype, vae=taef1).to(device)
|
517 |
#image_pipe.enable_model_cpu_offload()
|
518 |
|
519 |
torch.cuda.empty_cache()
|
@@ -599,7 +598,7 @@ def _summarize(text):
|
|
599 |
log(f'RET _summarize with ret as {ret}')
|
600 |
return ret
|
601 |
|
602 |
-
def summarize(text, max_words=
|
603 |
log(f'CALL summarize')
|
604 |
|
605 |
words = text.split()
|
@@ -1285,7 +1284,7 @@ def translate(txt,to_lang="en",from_lang="auto"):
|
|
1285 |
log(f'RET translate with translation as {translation}')
|
1286 |
return translation.lower()
|
1287 |
|
1288 |
-
@spaces.GPU(duration=
|
1289 |
def handle_generation(h,w,d):
|
1290 |
|
1291 |
log(f'CALL handle_generate')
|
@@ -1314,13 +1313,12 @@ def handle_generation(h,w,d):
|
|
1314 |
else:
|
1315 |
d = d if d == "" else translate(d)
|
1316 |
d = re.sub(r"([ \t]){1,}", " ", d)
|
1317 |
-
d = re.sub(r"(\. \.)", ".",
|
1318 |
-
|
1319 |
-
)).lower().strip()
|
1320 |
|
1321 |
neg = f"Textual, Text, Blurry, Distorted, Exceptional, Irregular, Unusual, Shiny, Smoothed, Polished, Low Quality, Worst Quality, Normal Quality, Anime Quality, Paint Quality, Movie Quality."
|
1322 |
q = "\""
|
1323 |
-
pos = f'Realistic
|
1324 |
|
1325 |
print(f"""
|
1326 |
Positive: {pos}
|
|
|
512 |
|
513 |
# torch pipes
|
514 |
|
515 |
+
image_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=dtype).to(device)
|
|
|
516 |
#image_pipe.enable_model_cpu_offload()
|
517 |
|
518 |
torch.cuda.empty_cache()
|
|
|
598 |
log(f'RET _summarize with ret as {ret}')
|
599 |
return ret
|
600 |
|
601 |
+
def summarize(text, max_words=10):
|
602 |
log(f'CALL summarize')
|
603 |
|
604 |
words = text.split()
|
|
|
1284 |
log(f'RET translate with translation as {translation}')
|
1285 |
return translation.lower()
|
1286 |
|
1287 |
+
@spaces.GPU(duration=150)
|
1288 |
def handle_generation(h,w,d):
|
1289 |
|
1290 |
log(f'CALL handle_generate')
|
|
|
1313 |
else:
|
1314 |
d = d if d == "" else translate(d)
|
1315 |
d = re.sub(r"([ \t]){1,}", " ", d)
|
1316 |
+
d = re.sub(r"(\. \.)", ".", d)
|
1317 |
+
d = re.sub(r"[,]", ";", d).lower().strip()
|
|
|
1318 |
|
1319 |
neg = f"Textual, Text, Blurry, Distorted, Exceptional, Irregular, Unusual, Shiny, Smoothed, Polished, Low Quality, Worst Quality, Normal Quality, Anime Quality, Paint Quality, Movie Quality."
|
1320 |
q = "\""
|
1321 |
+
pos = f'Realistic Real-Life Life-Like Convincing{ "." if d == "" else ": " + d }'
|
1322 |
|
1323 |
print(f"""
|
1324 |
Positive: {pos}
|