Spaces:
Running
Running
| import gradio as gr | |
| import os | |
| import datetime | |
| # --- Theme Configuration --- | |
| custom_theme = gr.themes.Default( | |
| primary_hue="blue", | |
| secondary_hue="blue", | |
| neutral_hue="slate", | |
| ).set( | |
| loader_color="#0071bb", | |
| button_primary_background_fill="#0071bb", | |
| button_primary_background_fill_hover="#005a94", | |
| button_primary_text_color="white", | |
| slider_color="#0071bb", | |
| checkbox_background_color_selected="#0071bb", | |
| checkbox_border_color_selected="#0071bb", | |
| body_background_fill="#0a0a0a", | |
| body_background_fill_dark="#0a0a0a", | |
| block_background_fill="#1a1a1a", | |
| block_background_fill_dark="#1a1a1a", | |
| ) | |
| # --- Environment Setup --- | |
| token = os.environ.get("TOKEN", "") | |
| model = os.environ.get("MODEL", "") | |
| # --- CSS --- | |
| css = """ | |
| /* 1. Global Layout & Colors */ | |
| .gradio-container { | |
| max-width: 1200px !important; | |
| margin: 0 auto !important; | |
| padding: 0 1rem !important; | |
| background: #0a0a0a !important; | |
| color: #ffffff !important; | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important; | |
| } | |
| a { color: #a0a0a0 !important; } | |
| footer, #huggingface-space-header { display: none !important; } | |
| /* 2. Header & Typography */ | |
| .header-container { text-align: center; padding: 2rem 0 1rem; } | |
| .logo-wrapper { display: flex; justify-content: center; align-items: center; gap: 2rem; margin-bottom: 1.5rem; } | |
| .logo-divider { width: 1px; height: 40px; background: #2a2a2a; } | |
| .main-title { font-size: 1.8rem; font-weight: 400; margin-bottom: 0.5rem; color: #fff; } | |
| .subtitle { color: #a0a0a0; font-size: 0.9rem; } | |
| .footer { text-align: center; padding: 3rem 0 2rem; border-top: 1px solid #2a2a2a; color: #a0a0a0; } | |
| /* 3. RESULT CARD STYLING */ | |
| .result-card { | |
| background: #111; | |
| border-radius: 12px; | |
| overflow: hidden; | |
| border: 1px solid #2a2a2a; | |
| margin-top: 1rem; | |
| } | |
| .video-wrapper { | |
| height: 420px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| background: #000; | |
| } | |
| .video-wrapper video { | |
| max-height: 100%; | |
| max-width: 100%; | |
| object-fit: contain; | |
| } | |
| .controls-wrapper { | |
| padding: 12px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| background: #161616; | |
| } | |
| .info { color: #a0a0a0; font-size: 0.9rem; } | |
| /* 4. BUTTON STYLING */ | |
| .action-btn-blue { | |
| background: #0071bb !important; | |
| color: white !important; | |
| padding: 10px 18px !important; | |
| border-radius: 8px !important; | |
| text-decoration: none !important; | |
| font-weight: 600 !important; | |
| font-size: 13px !important; | |
| border: none !important; | |
| cursor: pointer !important; | |
| transition: 0.2s !important; | |
| display: inline-flex !important; | |
| align-items: center !important; | |
| justify-content: center !important; | |
| } | |
| .action-btn-blue:hover { | |
| background: #005a94 !important; | |
| transform: translateY(-1px) !important; | |
| } | |
| .md-button { | |
| background: #1a1a1a !important; | |
| border: 1px solid #2a2a2a !important; | |
| color: #a0a0a0 !important; | |
| border-radius: 6px !important; | |
| font-family: inherit !important; | |
| transition: 0.2s !important; | |
| cursor: pointer !important; | |
| } | |
| .md-button:hover { | |
| background: #252525 !important; | |
| border-color: #0071bb !important; | |
| color: #fff !important; | |
| } | |
| /* 5. Placeholder & Gear Spin Animation */ | |
| .placeholder-box { | |
| height: 480px; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| background: #111; | |
| border: 2px dashed #222; | |
| border-radius: 12px; | |
| color: #666; | |
| } | |
| .gear-spin { | |
| font-size: 40px; | |
| animation: spin 2s linear infinite; | |
| display: inline-block; | |
| } | |
| @keyframes spin { 100% { transform: rotate(360deg); } } | |
| .loading-pulse { | |
| animation: pulse 2s ease-in-out infinite !important; | |
| } | |
| @keyframes pulse { | |
| 0%, 100% { opacity: 1; } | |
| 50% { opacity: 0.7; } | |
| } | |
| /* 6. Loaded Space Upload Inputs */ | |
| #upload_box, #end_frame_box { | |
| height: 280px !important; | |
| } | |
| @media (max-width: 768px) { | |
| #upload_box, #end_frame_box { | |
| height: 220px !important; | |
| } | |
| .video-wrapper { | |
| height: 320px; | |
| } | |
| } | |
| """ | |
| head = """ | |
| <link | |
| rel="icon" | |
| type="image/svg+xml" | |
| href="https://cms.cypherchat.app/uploads/favicon_8bc904ca6b.svg" | |
| /> | |
| """ | |
| loaded_demo = gr.load(model, src="spaces", token=token) | |
| with gr.Blocks( | |
| fill_height=False, | |
| fill_width=True, | |
| title="AskCyph™ Video Studio - Cypher Tech Inc.", | |
| ) as demo: | |
| # Header Section | |
| gr.HTML(""" | |
| <div class="header-container"> | |
| <div class="logo-wrapper"> | |
| <a href="#"><img src="https://cms.cypherchat.app/uploads/logo_white_4e6ca90bad.svg" alt="Cypher Tech" style="height:40px;"></a> | |
| <div class="logo-divider"></div> | |
| <a href="#"><img src="https://cms.cypherchat.app/uploads/askcyph_white_letter_6911d8dfaa.svg" alt="AskCyph" style="height:40px;"></a> | |
| </div> | |
| <h1 class="main-title">AskCyph™ Video Studio</h1> | |
| <p class="subtitle">Transform your ideas into stunning videos with audio AI</p> | |
| </div> | |
| """) | |
| # Load Video generator | |
| with gr.Group(): | |
| loaded_demo.render() | |
| # Footer Section | |
| current_year = datetime.datetime.now().year | |
| gr.HTML(f""" | |
| <div class="footer"> | |
| <p style="margin-top: 0.5rem; opacity: 0.7;"> | |
| Try <a href="https://askcyph.ai" target="_blank">AskCyph™</a> | |
| AI for higher limits and more features | | |
| © {current_year} | |
| <a href="https://cyphertech.co" target="_blank">Cypher Tech Inc</a>. | |
| </p> | |
| </div> | |
| """) | |
| if __name__ == "__main__": | |
| demo.launch( | |
| theme=custom_theme, | |
| css=css, | |
| head=head, | |
| show_error=False, | |
| quiet=True, | |
| footer_links=[], | |
| ) |