Spaces:
Paused
Paused
EthanBlake commited on
Commit ·
58beb2e
1
Parent(s): c25d72f
update
Browse files1212 unmodified lines12131214121512161217121812191220122112221223122412258 unmodified lines123412351236123712381239124012411242124312441245124612471320 unmodified lines25682569257025712572257325742575257625772578257925 unmodified lines26052606260726082609261026112612261326142615261612 unmodified lines2629263026312632263326342635263626372638263926401212 unmodified linesreturn f"{detail}\n{elapsed_line}"def _download_upsell_card_html() -> str:return ("<div style='margin-top:10px;padding:0;'>""<div style='border:1px solid #c7d2fe;border-radius:16px;overflow:hidden;""box-shadow:0 8px 22px rgba(99,102,241,0.16);background:linear-gradient(135deg,#eef2ff 0%,#e0e7ff 100%);'>""<div style='padding:14px 16px;color:#312e81;font-size:13px;line-height:1.7;text-align:center;'>""This Space is currently in Lite mode.<br/>Visit our Official Site for unbound creativity, commercial licensing, and 20s cinematic video.""</div>""<div style='display:flex;justify-content:center;padding:0 16px 16px 16px;'>""<a href='https://omnieditor.net/image-to-video' target='_blank' style='display:inline-flex;"8 unmodified lines)def _download_upsell_update(video_path: Optional[str], status_text: str = ""):text = str(status_text or "")if "NSFW blocked:" in text or "NSFW warning:" in text:return gr.update(value=_download_upsell_card_html(), visible=True)p = str(video_path or "").strip()if p and Path(p).exists():return gr.update(value=_download_upsell_card_html(), visible=True)return gr.update(value="", visible=False)1320 unmodified linesip,cc,)return (_public_generation_status(status),video,_nsfw_card_update_for_status(status),_nsfw_preview_update(preview),_download_upsell_update(video, status),)def _submit_i2v(25 unmodified linesip,cc,)return (_public_generation_status(status),video,_nsfw_card_update_for_status(status),_nsfw_preview_update(preview),_download_upsell_update(video, status),)def _submit_v2v(prompt, video_file, resolution, seconds_per_scene, aspect_ratio, request: gr.Request):12 unmodified linesip,cc,)return (_public_generation_status(status),video,_nsfw_card_update_for_status(status),_nsfw_preview_update(preview),_download_upsell_update(video, status),)def _generate_t2v_scenes(base_prompt, scene_count, seconds_per_scene, request: gr.Request):1212 unmodified lines121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012418 unmodified lines125012511252125312541255125612571258125912601261126212631320 unmodified lines258425852586258725882589259025912592259325942595259625 unmodified lines262226232624262526262627262826292630263126322633263412 unmodified lines26472648264926502651265226532654265526562657265826591212 unmodified linesreturn f"{detail}\n{elapsed_line}"def _should_show_like_tip(ip: str) -> bool:normalized_ip = _normalize_ip(ip)if not normalized_ip:return False_auto_total, video_total, _nsfw_total = _snapshot_usage_counts(normalized_ip)return int(video_total) >= 2def _download_upsell_card_html(show_like_tip: bool = False) -> str:like_tip_html = ""if show_like_tip:like_tip_html = ("<div style='margin-bottom:8px;font-weight:700;color:#1f1f7a;'>""If this Space helps you, please give us a ❤️ on Hugging Face.""</div>")return ("<div style='margin-top:10px;padding:0;'>""<div style='border:1px solid #c7d2fe;border-radius:16px;overflow:hidden;""box-shadow:0 8px 22px rgba(99,102,241,0.16);background:linear-gradient(135deg,#eef2ff 0%,#e0e7ff 100%);'>""<div style='padding:14px 16px;color:#312e81;font-size:13px;line-height:1.7;text-align:center;'>"+ like_tip_html+ "This Space is currently in Lite mode.<br/>Visit our Official Site for unbound creativity, commercial licensing, and 20s cinematic video.""</div>""<div style='display:flex;justify-content:center;padding:0 16px 16px 16px;'>""<a href='https://omnieditor.net/image-to-video' target='_blank' style='display:inline-flex;"8 unmodified lines)def _download_upsell_update(video_path: Optional[str], status_text: str = "", show_like_tip: bool = False):text = str(status_text or "")if "NSFW blocked:" in text or "NSFW warning:" in text:return gr.update(value=_download_upsell_card_html(show_like_tip=show_like_tip), visible=True)p = str(video_path or "").strip()if p and Path(p).exists():return gr.update(value=_download_upsell_card_html(show_like_tip=show_like_tip), visible=True)return gr.update(value="", visible=False)1320 unmodified linesip,cc,)show_like_tip = _should_show_like_tip(ip)return (_public_generation_status(status),video,_nsfw_card_update_for_status(status),_nsfw_preview_update(preview),_download_upsell_update(video, status, show_like_tip=show_like_tip),)def _submit_i2v(25 unmodified linesip,cc,)show_like_tip = _should_show_like_tip(ip)return (_public_generation_status(status),video,_nsfw_card_update_for_status(status),_nsfw_preview_update(preview),_download_upsell_update(video, status, show_like_tip=show_like_tip),)def _submit_v2v(prompt, video_file, resolution, seconds_per_scene, aspect_ratio, request: gr.Request):12 unmodified linesip,cc,)show_like_tip = _should_show_like_tip(ip)return (_public_generation_status(status),video,_nsfw_card_update_for_status(status),_nsfw_preview_update(preview),_download_upsell_update(video, status, show_like_tip=show_like_tip),)def _generate_t2v_scenes(base_prompt, scene_count, seconds_per_scene, request: gr.Request):
src/app_lib.py+27-8