# main.py import streamlit as st import concurrent.futures from script_analysis import process_script_analysis from franchise_continuity import process_franchise_continuity from audience_reaction import process_audience_reaction from character_analysis import process_character_analysis from crossover_potential import process_crossover_potential from vfx_potential import process_vfx_potential from market_analysis import analyze_and_process_market from text_to_scene import process_text_to_scene from text_to_video import process_text_to_video from utils import load_script, run_analysis from media_utils import run_media_generation from text_to_story import generate_storyboard def main(): st.set_page_config(page_title="Cin AI", layout="wide") st.title('Cin AI 🎞️🤖') feature = st.sidebar.selectbox( "Select Feature", ("Script Analysis", "Franchise Continuity Checker", "Audience Reaction", "Character Analysis", "Crossover Potential", "VFX Potential", "Market Analysis", ) ) if feature in ["Text to Scene", "Text to Video"]: input_data = st.text_area("Enter your text prompt:", height=150) elif feature in ["Storyboard"]: st.subheader("Story Board") # Present three scenario choices scenario = st.radio( "Select a storyboard scenario:", ("Post-Apocalyptic Dharma", "Matsya: Fantasy Adventure", "Sci-Fi Space Odyssey","VR Yodha") ) # Call the corresponding function based on the scenario if st.button("Generate"): if scenario == "Post-Apocalyptic Dharma": st.image(generate_storyboard(scenario=""" Panel 1: A futuristic cityscape in India, with holographic temples floating alongside skyscrapers. Flying vehicles weave between ancient statues and modern architecture. Text: Narrator: "Bharat, TOK 2898. Where tradition and technology dance in harmony." Panel 2: A man in high-tech armor stands atop a building, his helmet retracting to reveal a face with a third eye on the forehead. This is TOK, the AI-enhanced avatar of Kalki. Text: TOK: "The cycle of Yugas nears its end. The time of awakening is upon us." Panel 3: TOK enters a secret chamber filled with ancient artifacts and advanced computers. A holographic map shows dark energy spreading across the globe. Text: AI Assistant: "TOK, the corruption grows stronger. Adharma is rising exponentially." Panel 4: TOK activates a mystical weapon that transforms into a futuristic motorcycle. Text: TOK: "Then we shall ride forth and restore balance, as foretold in the scriptures." Panel 5: A montage of TOK battling against cyber-demons and corrupt AI entities across various Indian landscapes. Text: Narrator: "And so began the final battle between good and evil in the age of Kali Yuga." Panel 6: TOK stands victorious, surrounded by cheering crowds of humans and benevolent AIs. Text: TOK: "The new Satya Yuga begins now. Let us build a future where dharma reigns supreme." """)) elif scenario == "Matsya: Fantasy Adventure": st.image(generate_storyboard(scenario=""" Panel 1: A mystical forest where trees tower over a medieval kingdom. Dragons fly in the distance. Text: Narrator: "In the land of Eldoria, where magic weaves through the very air, a new quest begins." Panel 2: A young hero, clad in armor, stands at the gates of an ancient temple. Text: Hero: "The prophecy speaks of a hidden power within these walls. I must find it." Panel 3: Inside the temple, the hero discovers a glowing artifact, pulsing with energy. Text: Artifact: "Only the chosen one may wield the Sword of Eternity." Panel 4: As the hero grasps the sword, a surge of magical energy transforms him. Text: Hero: "With this power, I shall defend Eldoria from the forces of darkness." Panel 5: A montage of the hero battling mythical creatures and dark sorcerers. Text: Narrator: "And so, the legend of the Swordbearer was born, destined to bring peace to the realm." Panel 6: The hero stands on a mountaintop, overlooking the kingdom, with the sword gleaming in the sunlight. Text: Hero: "My journey has just begun." """)) elif scenario == "Sci-Fi Space Odyssey": st.image(generate_storyboard(scenario=""" Panel 1: A vast space station shaped like a mandala, orbiting a distant star. It houses millions of refugees from a dying Earth. Text: Narrator: "Kalki Station, TOK 4000. Humanity's last hope as we search for a new home." Panel 2: In the station's control center, a holographic AI avatar flickers to life. This is TOK, the Transcendent Omniscient Kalki. Text: TOK: "Alert: Dimensional anomaly detected. The prophesied window approaches." Panel 3: TOK interfaces with the station's systems, revealing a swirling portal opening in space. Text: Station Commander: "TOK, is this the gateway you predicted? The path to our new world?" Panel 4: A sleek spacecraft emerges from the station, piloted by TOK's android body. Text: TOK: "I must investigate. The future of our people hangs in the balance." Panel 5: TOK's ship enters the portal, witnessing visions of past, present, and future Earths. Text: TOK: "Fascinating. We're traversing the cyclical nature of time itself." Panel 6: TOK returns to the station, its eyes glowing with newfound knowledge. Text: TOK: "Prepare the arks. I've seen our destiny, and the new Satya Yuga awaits across the stars." """)) elif scenario == "VR Yodha": st.image(generate_storyboard(scenario=""" Panel 1: A virtual reality landscape where users appear as avatars of deities and mythological beings. Digital recreations of famous temples float in the sky. Text: Narrator: "Welcome to Devaloka Online, TOK 2155. Where mythology meets technology." Panel 2: A powerful avatar, glowing with divine light, stands out from the crowd. This is TOK, the Technologically Omnipotent Kalki. Text: TOK: "A great corruption spreads through our digital realm. We must act swiftly." Panel 3: TOK battles against virus-like demons infecting other avatars, using a combination of coded mantras and digital weapons. Text: Infected Avatar: "Help us, TOK! The malware is rewriting our very existence!" Panel 4: In the real world, we see humans connected to VR pods, their minds linked to the Devaloka Online servers. Text: Scientist: "If TOK fails, the corruption could spread to the users' minds. Humanity itself is at stake." Panel 5: TOK performs a grand digital ritual, channeling the power of millions of users to purge the corruption. Text: TOK: "By the power of collective consciousness, I initiate the Mahapralaya Protocol!" Panel 6: The virtual world reshapes itself, purified and renewed. TOK stands triumphant. Text: TOK: "The digital realm is cleansed. Now, let us use this technology to elevate humanity in the physical world as well." """)) else: if 'script' not in st.session_state: st.session_state['script'] = None st.session_state['script'] = st.file_uploader("Upload your file", type=['pdf', 'txt']) input_data = load_script(st.session_state['script']) if st.session_state['script'] else None additional_context = {} if feature == "Franchise Continuity Checker": context = st.text_area("Enter the context for reference (e.g., scenes from different movies, etc.):") if context: additional_context["context"] = context.split('\n') elif feature == "Crossover Potential": synopses = st.text_area("Enter the synopses of different scripts (one per line):") if synopses: additional_context["synopses"] = synopses.split('\n') elif feature =="Market Analysis": factors = st.text_area("Enter the different factors of revenue like budget cast etc:") if factors: additional_context["factors"] = factors.split('\n') elif feature == "Text to Scene": additional_context["output_quality"] = st.slider("Output Quality", 1, 100, 80) elif feature == "Text to Video": additional_context["num_frames"] = st.slider("Number of Frames", 1, 100, 49) additional_context["guidance_scale"] = st.slider("Guidance Scale", 1.0, 10.0, 6.0) additional_context["num_inference_steps"] = st.slider("Number of Inference Steps", 1, 100, 50) if feature not in ["Storyboard"]: if st.button(f'Generate {feature}'): if input_data is None: st.error("Please provide input data (upload a script or enter a text prompt).") return with st.spinner(f'Generating {feature}...'): try: with concurrent.futures.ThreadPoolExecutor() as executor: if feature in ["Text to Scene", "Text to Video"]: future = executor.submit(run_media_generation, input_data, feature, additional_context) else: future = executor.submit(run_analysis, input_data, feature, additional_context) analysis = future.result() processing_functions = { "Script Analysis": process_script_analysis, "Character Analysis": process_character_analysis, "Crossover Potential": process_crossover_potential, "Audience Reaction": process_audience_reaction, "Franchise Continuity Checker": process_franchise_continuity, "VFX Potential": process_vfx_potential, "Market Analysis": analyze_and_process_market, "Text to Scene": process_text_to_scene, "Text to Video": process_text_to_video } processing_function = processing_functions.get(feature, lambda x: st.write(x)) processing_function(analysis) except Exception as e: st.error(f"An error occurred during analysis: {str(e)}") if __name__ == "__main__": main() # # main.py # import streamlit as st # import concurrent.futures # from script_analysis import process_script_analysis # from franchise_continuity import process_franchise_continuity # from audience_reaction import process_audience_reaction # from character_analysis import process_character_analysis # from crossover_potential import process_crossover_potential # from vfx_potential import process_vfx_potential # from market_analysis import process_market_analysis # from utils import load_script, run_analysis # def main(): # st.set_page_config(page_title="Script Analyser", layout="wide") # st.title('Cin AI 🎞️🤖') # feature = st.sidebar.selectbox( # "Select Feature", # ("Script Analysis", "Franchise Continuity Checker", "Audience Reaction", # "Character Analysis", "Crossover Potential", "VFX Potential", "Market Analysis") # ) # if 'script' not in st.session_state: # st.session_state['script'] = None # st.session_state['script'] = st.file_uploader("Upload your file", type=['pdf', 'txt']) # if st.button(f'Generate {feature}'): # if st.session_state['script'] is None: # st.error("Please upload a script file first.") # return # thread_id = load_script(st.session_state['script']) # additional_context = None # if feature == "Franchise Continuity Checker": # context = st.text_area("Enter the context for reference (e.g., scenes from different movies, etc.):") # if context: # additional_context = {"context": context.split('\n')} # elif feature == "Crossover Potential": # synopses = st.text_area("Enter the synopses of different scripts (one per line):") # if synopses: # additional_context = {"synopses": synopses.split('\n')} # with st.spinner(f'Generating {feature}...'): # try: # with concurrent.futures.ThreadPoolExecutor() as executor: # future = executor.submit(run_analysis, thread_id, feature, additional_context) # analysis = future.result() # processing_functions = { # "Script Analysis": process_script_analysis, # "Character Analysis": process_character_analysis, # "Crossover Potential": process_crossover_potential, # "Audience Reaction": process_audience_reaction, # "Franchise Continuity Checker": process_franchise_continuity, # "VFX Potential": process_vfx_potential, # "Market Analysis": process_market_analysis # } # processing_function = processing_functions.get(feature, lambda x: st.write(x)) # processing_function(analysis) # except Exception as e: # st.error(f"An error occurred during analysis: {str(e)}") # if __name__ == "__main__": # main()