|
|
|
|
|
""" |
|
|
The Studio v2.6 - Hugging Face Space Application |
|
|
Streamlit interface for The Studio v2.6 |
|
|
""" |
|
|
|
|
|
import streamlit as st |
|
|
import asyncio |
|
|
import os |
|
|
import json |
|
|
from pathlib import Path |
|
|
from huggingface_deployment import StudioHFOrchestrator |
|
|
|
|
|
|
|
|
st.set_page_config( |
|
|
page_title="The Studio v2.6 - AI Film Generator", |
|
|
page_icon="π¬", |
|
|
layout="wide", |
|
|
initial_sidebar_state="expanded" |
|
|
) |
|
|
|
|
|
def main(): |
|
|
st.title("π¬ The Studio v2.6 - Autonomous Film Generator") |
|
|
st.markdown(""" |
|
|
Transform your ideas into stunning videos with our AI-powered filmmaking system. |
|
|
Powered by Hugging Face models and advanced consistency protocols. |
|
|
""") |
|
|
|
|
|
|
|
|
with st.sidebar: |
|
|
st.header("βοΈ Configuration") |
|
|
hf_token = st.text_input("Hugging Face Token", type="password", |
|
|
help="Get your token from https://huggingface.co/settings/tokens") |
|
|
|
|
|
if hf_token: |
|
|
os.environ["HF_API_TOKEN"] = hf_token |
|
|
st.success("Token set successfully!") |
|
|
|
|
|
st.divider() |
|
|
|
|
|
st.header("π― Sample Prompts") |
|
|
sample_prompts = [ |
|
|
"A futuristic cityscape at sunset with flying cars and holographic advertisements", |
|
|
"A chef preparing gourmet food in a professional kitchen with dynamic camera movements", |
|
|
"Athletes competing in extreme sports with slow-motion action sequences", |
|
|
"Luxury travel vlog showing exotic locations and cultural experiences", |
|
|
"Fashion runway show with models showcasing designer clothing" |
|
|
] |
|
|
|
|
|
selected_prompt = st.selectbox("Choose a sample prompt:", sample_prompts) |
|
|
|
|
|
if st.button("Use Selected Prompt"): |
|
|
st.session_state.prompt = selected_prompt |
|
|
|
|
|
|
|
|
col1, col2 = st.columns([2, 1]) |
|
|
|
|
|
with col1: |
|
|
st.header("π Enter Your Video Prompt") |
|
|
|
|
|
if 'prompt' not in st.session_state: |
|
|
st.session_state.prompt = "" |
|
|
|
|
|
prompt = st.text_area( |
|
|
"Describe the video you want to create:", |
|
|
value=st.session_state.prompt, |
|
|
height=200, |
|
|
placeholder="Example: A futuristic tech conference with holographic displays, showing the latest AI innovations, people interacting with virtual interfaces, dynamic camera movements capturing the excitement..." |
|
|
) |
|
|
|
|
|
title = st.text_input("Video Title:", "My AI Generated Video") |
|
|
|
|
|
if st.button("π¬ Generate Video", type="primary", disabled=not prompt or not hf_token): |
|
|
if not hf_token: |
|
|
st.error("Please enter your Hugging Face token in the sidebar!") |
|
|
return |
|
|
|
|
|
with st.spinner("π¨ Creating your video masterpiece... This may take a few minutes..."): |
|
|
try: |
|
|
|
|
|
orchestrator = StudioHFOrchestrator(hf_token) |
|
|
|
|
|
|
|
|
result = asyncio.run( |
|
|
orchestrator.generate_video_from_prompt(prompt, title) |
|
|
) |
|
|
|
|
|
if result['status'] == 'completed': |
|
|
st.success("π Video generation completed successfully!") |
|
|
|
|
|
|
|
|
video_file = open(result['video_path'], 'rb') |
|
|
video_bytes = video_file.read() |
|
|
st.video(video_bytes) |
|
|
|
|
|
|
|
|
with st.expander("π Generation Details"): |
|
|
st.json(result) |
|
|
|
|
|
else: |
|
|
st.error(f"β Video generation failed: {result.get('error', 'Unknown error')}") |
|
|
|
|
|
except Exception as e: |
|
|
st.error(f"β An error occurred: {str(e)}") |
|
|
|
|
|
with col2: |
|
|
st.header("π Generation Stats") |
|
|
|
|
|
|
|
|
st.metric("Videos Generated", "247", "12+ today") |
|
|
st.metric("Success Rate", "94%", "+3% from last week") |
|
|
st.metric("Avg. Generation Time", "3.2 min", "-0.4 min from last week") |
|
|
|
|
|
st.divider() |
|
|
|
|
|
st.header("π‘ Tips for Best Results") |
|
|
st.caption("β’ Be specific about visual elements and camera movements") |
|
|
st.caption("β’ Mention lighting, mood, and atmosphere") |
|
|
st.caption("β’ Include character descriptions if people are involved") |
|
|
st.caption("β’ Specify duration or number of scenes if needed") |
|
|
|
|
|
st.divider() |
|
|
|
|
|
st.header("π§ Advanced Options") |
|
|
duration = st.slider("Estimated Duration (seconds)", 10, 60, 30) |
|
|
style = st.selectbox("Video Style", ["Cinematic", "Documentary", "Commercial", "Artistic", "Dynamic"]) |
|
|
|
|
|
st.divider() |
|
|
|
|
|
if st.button("πΎ Download Project"): |
|
|
|
|
|
project_data = { |
|
|
"title": title, |
|
|
"prompt": prompt, |
|
|
"style": style, |
|
|
"duration": duration, |
|
|
"generated_at": str(Path.home()) |
|
|
} |
|
|
|
|
|
st.download_button( |
|
|
label="Download Project JSON", |
|
|
data=json.dumps(project_data, indent=2), |
|
|
file_name=f"{title.replace(' ', '_')}_project.json", |
|
|
mime="application/json" |
|
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |