Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ PER_USER_DAILY = int(os.environ.get("PER_USER_DAILY", 3))
|
|
| 22 |
GLOBAL_DAILY = int(os.environ.get("GLOBAL_DAILY", 200))
|
| 23 |
ADMIN_USERS = {u.strip().lower() for u in os.environ.get("ADMIN_USERS", "").split(",") if u.strip()}
|
| 24 |
FLOW = os.environ.get("FLOW", "oneshot").strip().lower() # "oneshot" or "twostep"
|
|
|
|
| 25 |
POLL_EVERY = 5 # seconds between status checks
|
| 26 |
JOB_TIMEOUT = 900 # give up after 15 minutes
|
| 27 |
FONT = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
|
|
@@ -198,7 +199,8 @@ def startup_check():
|
|
| 198 |
else:
|
| 199 |
print(f"[startup] WARNING: no route found for {name}; keeping {PATHS[name]}")
|
| 200 |
print(f"[startup] using paths: {PATHS}")
|
| 201 |
-
print(f"[startup] flow: {FLOW} |
|
|
|
|
| 202 |
|
| 203 |
|
| 204 |
def build_drama(mood, excited, angry):
|
|
@@ -232,7 +234,7 @@ def submit_job(video, audio, drama, find_face_id=None, face_id=None):
|
|
| 232 |
if find_face_id:
|
| 233 |
data.update({"find_face_id": find_face_id, "global_face_id": str(face_id)})
|
| 234 |
else:
|
| 235 |
-
data["skip_find_face"] =
|
| 236 |
with open(video, "rb") as v, open(audio, "rb") as a:
|
| 237 |
files = {"audio": (os.path.basename(audio), a)}
|
| 238 |
if not find_face_id:
|
|
@@ -453,4 +455,4 @@ with gr.Blocks(title="DRAMA: facial expression editing") as demo:
|
|
| 453 |
)
|
| 454 |
|
| 455 |
startup_check()
|
| 456 |
-
demo.queue(max_size=20).launch()
|
|
|
|
| 22 |
GLOBAL_DAILY = int(os.environ.get("GLOBAL_DAILY", 200))
|
| 23 |
ADMIN_USERS = {u.strip().lower() for u in os.environ.get("ADMIN_USERS", "").split(",") if u.strip()}
|
| 24 |
FLOW = os.environ.get("FLOW", "oneshot").strip().lower() # "oneshot" or "twostep"
|
| 25 |
+
SKIP_FIND_FACE = os.environ.get("SKIP_FIND_FACE", "1").strip() # value sent in one-step mode
|
| 26 |
POLL_EVERY = 5 # seconds between status checks
|
| 27 |
JOB_TIMEOUT = 900 # give up after 15 minutes
|
| 28 |
FONT = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
|
|
|
|
| 199 |
else:
|
| 200 |
print(f"[startup] WARNING: no route found for {name}; keeping {PATHS[name]}")
|
| 201 |
print(f"[startup] using paths: {PATHS}")
|
| 202 |
+
print(f"[startup] flow: {FLOW} | skip_find_face={SKIP_FIND_FACE} (one-step only)"
|
| 203 |
+
f" | admins (no limits): {sorted(ADMIN_USERS) or 'none'}")
|
| 204 |
|
| 205 |
|
| 206 |
def build_drama(mood, excited, angry):
|
|
|
|
| 234 |
if find_face_id:
|
| 235 |
data.update({"find_face_id": find_face_id, "global_face_id": str(face_id)})
|
| 236 |
else:
|
| 237 |
+
data["skip_find_face"] = SKIP_FIND_FACE
|
| 238 |
with open(video, "rb") as v, open(audio, "rb") as a:
|
| 239 |
files = {"audio": (os.path.basename(audio), a)}
|
| 240 |
if not find_face_id:
|
|
|
|
| 455 |
)
|
| 456 |
|
| 457 |
startup_check()
|
| 458 |
+
demo.queue(max_size=20).launch()
|