Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1456,23 +1456,27 @@ def handle_generation(h,w,d):
|
|
1456 |
if not working:
|
1457 |
|
1458 |
working = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1459 |
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
d_lines[line_index] = d_lines[line_index].strip() + "."
|
1467 |
-
d = " ".join(d_lines)
|
1468 |
-
|
1469 |
-
pos_d = re.sub(r"([ \t]){1,}", " ", d).lower().strip()
|
1470 |
-
pos_d = pos_d if pos_d == "" else summarize(translate(pos_d))
|
1471 |
-
pos_d = re.sub(r"([ \t]){1,}", " ", pos_d).lower().strip()
|
1472 |
|
1473 |
neg = f"Textual, Text, Distorted, Fake, Discontinuous, Blurry, Doll-Like, Overly Plastic, Low Quality, Paint, Smoothed, Artificial, Phony, Gaudy, Digital Effects."
|
1474 |
q = "\""
|
1475 |
-
pos = f'HQ Hyper-realistic professional photograph{
|
1476 |
|
1477 |
print(f"""
|
1478 |
Positive: {pos}
|
|
|
1456 |
if not working:
|
1457 |
|
1458 |
working = True
|
1459 |
+
|
1460 |
+
if len(d) > 0:
|
1461 |
+
d = re.sub(r",( ){1,}",". ",d)
|
1462 |
+
d_lines = re.split(r"([\n]){1,}", d)
|
1463 |
+
|
1464 |
+
for line_index in range(len(d_lines)):
|
1465 |
+
d_lines[line_index] = d_lines[line_index].strip()
|
1466 |
+
if re.sub(r'[\.]$', '', d_lines[line_index]) == d_lines[line_index]:
|
1467 |
+
d_lines[line_index] = d_lines[line_index].strip() + "."
|
1468 |
+
d = " ".join(d_lines)
|
1469 |
|
1470 |
+
d = re.sub(r"([ \t]){1,}", " ", d).lower().strip()
|
1471 |
+
if len(d) > 400:
|
1472 |
+
d = pos_d if pos_d == "" else summarize(translate(d))
|
1473 |
+
else:
|
1474 |
+
d = pos_d if pos_d == "" else translate(d)
|
1475 |
+
d = re.sub(r"([ \t]){1,}", " ", d).lower().strip()
|
|
|
|
|
|
|
|
|
|
|
|
|
1476 |
|
1477 |
neg = f"Textual, Text, Distorted, Fake, Discontinuous, Blurry, Doll-Like, Overly Plastic, Low Quality, Paint, Smoothed, Artificial, Phony, Gaudy, Digital Effects."
|
1478 |
q = "\""
|
1479 |
+
pos = f'HQ Hyper-realistic professional photograph{ d if d == "" else ": " + d }.'
|
1480 |
|
1481 |
print(f"""
|
1482 |
Positive: {pos}
|