|
import gradio as gr |
|
import os |
|
|
|
css = """ |
|
:root { |
|
--bg-primary: #0a0a0a; |
|
--bg-secondary: #141414; |
|
--bg-card: #1a1a1a; |
|
--bg-hover: #252525; |
|
--border-color: #2a2a2a; |
|
--text-primary: #ffffff; |
|
--text-secondary: #a0a0a0; |
|
--accent-blue: #3b82f6; |
|
--gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); |
|
} |
|
.gradio-container { |
|
background: var(--bg-primary) !important; |
|
color: var(--text-primary) !important; |
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important; |
|
} |
|
/* Header styling */ |
|
.header-container { |
|
text-align: center; |
|
padding: 3rem 0 2rem; |
|
background: var(--bg-primary); |
|
} |
|
.logo-wrapper { |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
gap: 2rem; |
|
margin-bottom: 2rem; |
|
} |
|
.logo-divider { |
|
width: 1px; |
|
height: 40px; |
|
background: var(--border-color); |
|
} |
|
.main-title { |
|
font-size: 2rem; |
|
font-weight: 400; |
|
margin-bottom: 0.5rem; |
|
color: var(--text-primary); |
|
} |
|
.subtitle { |
|
color: var(--text-secondary); |
|
font-size: 1rem; |
|
} |
|
/* Input styling */ |
|
.gr-input, .gr-textarea, textarea, input[type="text"], input[type="number"] { |
|
background: var(--bg-secondary) !important; |
|
border: 1px solid var(--border-color) !important; |
|
color: var(--text-primary) !important; |
|
border-radius: 8px !important; |
|
} |
|
.gr-input:focus, .gr-textarea:focus, textarea:focus, input:focus { |
|
border-color: var(--accent-blue) !important; |
|
outline: none !important; |
|
background: var(--bg-hover) !important; |
|
} |
|
/* Button styling */ |
|
.primary-btn, .gr-button-primary { |
|
background: var(--gradient) !important; |
|
color: white !important; |
|
border: none !important; |
|
border-radius: 8px !important; |
|
font-weight: 600 !important; |
|
transition: all 0.2s ease !important; |
|
} |
|
.primary-btn:hover, .gr-button-primary:hover { |
|
transform: translateY(-1px) !important; |
|
box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3) !important; |
|
} |
|
.secondary-btn { |
|
background: transparent !important; |
|
color: var(--accent-blue) !important; |
|
border: 1px solid var(--accent-blue) !important; |
|
border-radius: 8px !important; |
|
transition: all 0.2s ease !important; |
|
} |
|
.secondary-btn:hover { |
|
background: var(--accent-blue) !important; |
|
color: white !important; |
|
} |
|
/* Card backgrounds */ |
|
.gr-group { |
|
background: var(--bg-card) !important; |
|
border: 1px solid var(--border-color) !important; |
|
border-radius: 12px !important; |
|
} |
|
/* Slider styling */ |
|
input[type="range"]::-webkit-slider-track { |
|
background: var(--bg-secondary) !important; |
|
height: 6px !important; |
|
border-radius: 3px !important; |
|
border: 1px solid var(--border-color) !important; |
|
} |
|
input[type="range"]::-webkit-slider-thumb { |
|
-webkit-appearance: none !important; |
|
background: var(--accent-blue) !important; |
|
width: 18px !important; |
|
height: 18px !important; |
|
border-radius: 50% !important; |
|
cursor: pointer !important; |
|
} |
|
/* Audio upload styling */ |
|
.gr-audio { |
|
background: var(--bg-secondary) !important; |
|
border: 1px solid var(--border-color) !important; |
|
border-radius: 8px !important; |
|
} |
|
/* Label styling */ |
|
label { |
|
color: var(--text-secondary) !important; |
|
font-weight: 500 !important; |
|
margin-bottom: 0.5rem !important; |
|
} |
|
/* Accordion styling */ |
|
.gr-accordion { |
|
background: var(--bg-card) !important; |
|
border: 1px solid var(--border-color) !important; |
|
border-radius: 8px !important; |
|
} |
|
button.gr-accordion-header { |
|
background: transparent !important; |
|
color: var(--text-primary) !important; |
|
border: none !important; |
|
padding: 1rem !important; |
|
font-weight: 500 !important; |
|
} |
|
button.gr-accordion-header:hover { |
|
background: var(--bg-hover) !important; |
|
} |
|
/* Info message */ |
|
.info-message { |
|
background: rgba(59, 130, 246, 0.1); |
|
border: 1px solid var(--accent-blue); |
|
border-radius: 8px; |
|
padding: 1rem; |
|
margin: 1rem 0; |
|
color: var(--text-primary); |
|
} |
|
/* Footer */ |
|
.footer { |
|
text-align: center; |
|
padding: 3rem 0 2rem; |
|
margin-top: 4rem; |
|
border-top: 1px solid var(--border-color); |
|
color: var(--text-secondary); |
|
} |
|
a { |
|
color: var(--text-secondary) !important; |
|
} |
|
/* Hide default Gradio branding */ |
|
#huggingface-space-header, footer, huggingface-space-header { |
|
display: none !important; |
|
} |
|
""" |
|
token = os.environ["TOKEN"] |
|
model=os.environ["MODEL"] |
|
with gr.Blocks(fill_height=False,fill_width=False,css=css,js=""" |
|
() => { |
|
document.title ='AskCyph™ Video Generation - Cypher Tech Inc.'; |
|
const link = document.querySelector("link[rel~='icon']") || document.createElement('link'); |
|
link.type = 'image/svg+xml'; |
|
link.rel = 'icon'; |
|
link.href = 'https://cms.cypherchat.app/uploads/favicon_8bc904ca6b.svg'; |
|
document.getElementsByTagName('head')[0].appendChild(link); |
|
} |
|
""",theme=gr.themes.Default( |
|
primary_hue="blue", |
|
neutral_hue="gray", |
|
text_size="md" |
|
).set( |
|
body_background_fill="#0a0a0a", |
|
body_background_fill_dark="#0a0a0a", |
|
block_background_fill="#1a1a1a", |
|
block_background_fill_dark="#1a1a1a" |
|
)) as demo: |
|
loaded_demo = gr.load(model, src="spaces", token=token) |
|
demo.launch(show_api=False, show_error=False, quiet=True, debug=False) |