Update app.py
Browse files
app.py
CHANGED
|
@@ -1037,6 +1037,15 @@ FAQ = [ # order follows the review: what it is, free access, how to, API, then
|
|
| 1037 |
EXAMPLES_REPO = os.environ.get("EXAMPLES_REPO", "trydrama-neuralgarage/DRAMA")
|
| 1038 |
EXAMPLES_FOLDERS = ["drama-examples", "drama_examples"] # either spelling works
|
| 1039 |
EXAMPLES_VISIBLE = 3 # rows shown before "Show more examples"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1040 |
EX_DOWNLOAD = os.path.abspath("example_cache") # copy of the repo folder
|
| 1041 |
EX_WEB = os.path.abspath("example_web") # browser-ready MP4s and still frames
|
| 1042 |
|
|
@@ -1127,9 +1136,11 @@ def examples_html(rows):
|
|
| 1127 |
f'<video src="{_file_url(video)}"{poster_attr} controls muted playsinline preload="none"></video>'
|
| 1128 |
f'<figcaption>{cap}</figcaption></figure>')
|
| 1129 |
def row(folder, clips):
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
|
|
|
|
|
|
| 1133 |
shown = "".join(row(*r) for r in rows[:EXAMPLES_VISIBLE])
|
| 1134 |
more = rows[EXAMPLES_VISIBLE:]
|
| 1135 |
more_html = (f'<details class="dr-ex-more"><summary>Show {len(more)} more example{"s" if len(more) != 1 else ""}'
|
|
@@ -1221,6 +1232,9 @@ CSS = """
|
|
| 1221 |
:root { --dr-red: #e3141c; --dr-red-soft: rgba(227,20,28,.12); --dr-line: #2a2a32; --dr-card: #121216;
|
| 1222 |
--dr-text: #ededf0; --dr-muted: #9a9aa6; --dr-faint: #6b6b76; }
|
| 1223 |
.gradio-container { max-width: 1120px !important; margin: 0 auto !important; padding: 0 24px 48px !important; }
|
|
|
|
|
|
|
|
|
|
| 1224 |
.gradio-container .main.app { padding: 8px 0 !important; }
|
| 1225 |
.gradio-container .html-container { padding: 0 !important; }
|
| 1226 |
.gradio-container .prose { max-width: none !important; }
|
|
@@ -1412,11 +1426,15 @@ body.dr-sliding, body.dr-sliding * { cursor: grabbing !important; user-select: n
|
|
| 1412 |
.gradio-container .dr-video-fig figcaption b { display: block; color: #fff !important; font-weight: 600 !important; font-size: 14px !important; }
|
| 1413 |
|
| 1414 |
/* example grid */
|
| 1415 |
-
.gradio-container .dr-ex {
|
| 1416 |
-
|
| 1417 |
-
.gradio-container .dr-ex-
|
| 1418 |
-
|
| 1419 |
-
.gradio-container .dr-ex-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1420 |
.gradio-container .dr-ex-grid figure { margin: 0 !important; min-width: 0; }
|
| 1421 |
.gradio-container .dr-ex-grid video { display: block; width: 100% !important; aspect-ratio: 16 / 9; object-fit: contain;
|
| 1422 |
background: #000; border-radius: 10px; border: 1px solid var(--dr-line); }
|
|
@@ -1425,14 +1443,14 @@ body.dr-sliding, body.dr-sliding * { cursor: grabbing !important; user-select: n
|
|
| 1425 |
font-size: 13px !important; color: var(--dr-muted) !important; }
|
| 1426 |
.gradio-container .dr-ex-grid figcaption b { color: #fff !important; font-weight: 600 !important; }
|
| 1427 |
.gradio-container .dr-ex-grid figcaption span::before { content: "路"; margin-right: 8px; color: var(--dr-faint); }
|
| 1428 |
-
.gradio-container .dr-ex-more { display:
|
| 1429 |
-
.gradio-container .dr-ex-more > summary { list-style: none; cursor: pointer;
|
| 1430 |
font-weight: 600 !important; color: #fff !important; padding: 9px 18px !important; border-radius: 999px;
|
| 1431 |
border: 1px solid var(--dr-line); }
|
| 1432 |
.gradio-container .dr-ex-more > summary::-webkit-details-marker { display: none; }
|
| 1433 |
.gradio-container .dr-ex-more > summary:hover { border-color: #4a4a55; }
|
| 1434 |
.gradio-container .dr-ex-more[open] > summary { display: none; }
|
| 1435 |
-
.gradio-container .dr-ex-more[open] { display:
|
| 1436 |
|
| 1437 |
/* FAQ */
|
| 1438 |
.gradio-container .dr-faq { display: grid; border-top: 1px solid var(--dr-line); }
|
|
@@ -1474,6 +1492,9 @@ body.dr-sliding, body.dr-sliding * { cursor: grabbing !important; user-select: n
|
|
| 1474 |
.gradio-container .dr-ex-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%;
|
| 1475 |
overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
|
| 1476 |
.gradio-container .dr-ex-grid figure { scroll-snap-align: start; }
|
|
|
|
|
|
|
|
|
|
| 1477 |
.gradio-container .dr-hero { padding: 40px 0 28px; }
|
| 1478 |
.gradio-container .dr-hero .dr-sub { font-size: 16px !important; }
|
| 1479 |
.gradio-container .dr-meta { gap: 4px 14px; }
|
|
|
|
| 1037 |
EXAMPLES_REPO = os.environ.get("EXAMPLES_REPO", "trydrama-neuralgarage/DRAMA")
|
| 1038 |
EXAMPLES_FOLDERS = ["drama-examples", "drama_examples"] # either spelling works
|
| 1039 |
EXAMPLES_VISIBLE = 3 # rows shown before "Show more examples"
|
| 1040 |
+
EXAMPLE_TITLES = { # folder number -> what the example shows (folders without a title fall back to "Example NN")
|
| 1041 |
+
"1": "High precision",
|
| 1042 |
+
"2": "Studio shot, lip movement preserved",
|
| 1043 |
+
"3": "Side angle",
|
| 1044 |
+
"4": "Lighting variation",
|
| 1045 |
+
"5": "Multiple faces",
|
| 1046 |
+
"6": "Webcam footage",
|
| 1047 |
+
"7": "Moving camera",
|
| 1048 |
+
}
|
| 1049 |
EX_DOWNLOAD = os.path.abspath("example_cache") # copy of the repo folder
|
| 1050 |
EX_WEB = os.path.abspath("example_web") # browser-ready MP4s and still frames
|
| 1051 |
|
|
|
|
| 1136 |
f'<video src="{_file_url(video)}"{poster_attr} controls muted playsinline preload="none"></video>'
|
| 1137 |
f'<figcaption>{cap}</figcaption></figure>')
|
| 1138 |
def row(folder, clips):
|
| 1139 |
+
num = f"{int(folder):02d}" if folder.isdigit() else folder
|
| 1140 |
+
title = EXAMPLE_TITLES.get(folder.lstrip("0") or folder, f"Example {num}")
|
| 1141 |
+
return (f'<div class="dr-ex-row dr-sync"><div class="dr-ex-head"><span class="dr-ex-num">{num}</span>'
|
| 1142 |
+
f'<h3>{title}</h3></div>'
|
| 1143 |
+
f'<div class="dr-ex-grid">{"".join(figure(*c) for c in clips)}</div></div>')
|
| 1144 |
shown = "".join(row(*r) for r in rows[:EXAMPLES_VISIBLE])
|
| 1145 |
more = rows[EXAMPLES_VISIBLE:]
|
| 1146 |
more_html = (f'<details class="dr-ex-more"><summary>Show {len(more)} more example{"s" if len(more) != 1 else ""}'
|
|
|
|
| 1232 |
:root { --dr-red: #e3141c; --dr-red-soft: rgba(227,20,28,.12); --dr-line: #2a2a32; --dr-card: #121216;
|
| 1233 |
--dr-text: #ededf0; --dr-muted: #9a9aa6; --dr-faint: #6b6b76; }
|
| 1234 |
.gradio-container { max-width: 1120px !important; margin: 0 auto !important; padding: 0 24px 48px !important; }
|
| 1235 |
+
/* let the example grid extend wider than the page column; the page itself clips any sideways overflow */
|
| 1236 |
+
.gradio-container { overflow: visible !important; }
|
| 1237 |
+
html, body { overflow-x: clip !important; }
|
| 1238 |
.gradio-container .main.app { padding: 8px 0 !important; }
|
| 1239 |
.gradio-container .html-container { padding: 0 !important; }
|
| 1240 |
.gradio-container .prose { max-width: none !important; }
|
|
|
|
| 1426 |
.gradio-container .dr-video-fig figcaption b { display: block; color: #fff !important; font-weight: 600 !important; font-size: 14px !important; }
|
| 1427 |
|
| 1428 |
/* example grid */
|
| 1429 |
+
.gradio-container .dr-ex { width: min(1440px, calc(100vw - 64px)); position: relative; left: 50%;
|
| 1430 |
+
transform: translateX(-50%); min-width: 0; }
|
| 1431 |
+
.gradio-container .dr-ex-row { min-width: 0; margin: 0 0 56px !important; }
|
| 1432 |
+
.gradio-container .dr-ex-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px !important; }
|
| 1433 |
+
.gradio-container .dr-ex-num { font: 600 12px/1 ui-monospace, "SF Mono", Menlo, monospace !important;
|
| 1434 |
+
color: var(--dr-red) !important; }
|
| 1435 |
+
.gradio-container .dr-ex-head h3 { font-size: 18px !important; font-weight: 600 !important; color: #fff !important;
|
| 1436 |
+
margin: 0 !important; letter-spacing: -0.01em; }
|
| 1437 |
+
.gradio-container .dr-ex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
|
| 1438 |
.gradio-container .dr-ex-grid figure { margin: 0 !important; min-width: 0; }
|
| 1439 |
.gradio-container .dr-ex-grid video { display: block; width: 100% !important; aspect-ratio: 16 / 9; object-fit: contain;
|
| 1440 |
background: #000; border-radius: 10px; border: 1px solid var(--dr-line); }
|
|
|
|
| 1443 |
font-size: 13px !important; color: var(--dr-muted) !important; }
|
| 1444 |
.gradio-container .dr-ex-grid figcaption b { color: #fff !important; font-weight: 600 !important; }
|
| 1445 |
.gradio-container .dr-ex-grid figcaption span::before { content: "路"; margin-right: 8px; color: var(--dr-faint); }
|
| 1446 |
+
.gradio-container .dr-ex-more { display: block; }
|
| 1447 |
+
.gradio-container .dr-ex-more > summary { list-style: none; cursor: pointer; width: max-content; margin: 0 auto !important; font-size: 14px !important;
|
| 1448 |
font-weight: 600 !important; color: #fff !important; padding: 9px 18px !important; border-radius: 999px;
|
| 1449 |
border: 1px solid var(--dr-line); }
|
| 1450 |
.gradio-container .dr-ex-more > summary::-webkit-details-marker { display: none; }
|
| 1451 |
.gradio-container .dr-ex-more > summary:hover { border-color: #4a4a55; }
|
| 1452 |
.gradio-container .dr-ex-more[open] > summary { display: none; }
|
| 1453 |
+
.gradio-container .dr-ex-more[open] { display: block; }
|
| 1454 |
|
| 1455 |
/* FAQ */
|
| 1456 |
.gradio-container .dr-faq { display: grid; border-top: 1px solid var(--dr-line); }
|
|
|
|
| 1492 |
.gradio-container .dr-ex-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%;
|
| 1493 |
overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
|
| 1494 |
.gradio-container .dr-ex-grid figure { scroll-snap-align: start; }
|
| 1495 |
+
.gradio-container .dr-ex { width: calc(100vw - 48px); }
|
| 1496 |
+
.gradio-container .dr-ex-row { margin-bottom: 40px !important; }
|
| 1497 |
+
.gradio-container .dr-ex-head h3 { font-size: 16px !important; }
|
| 1498 |
.gradio-container .dr-hero { padding: 40px 0 28px; }
|
| 1499 |
.gradio-container .dr-hero .dr-sub { font-size: 16px !important; }
|
| 1500 |
.gradio-container .dr-meta { gap: 4px 14px; }
|