Spaces:
Sleeping
Sleeping
import streamlit as st | |
from gradio_client import Client | |
from utils import get_scenes, generate_video_assets, generate_video # Import the function from utils.py | |
# Streamlit app | |
st.title("Text to Video Generator") | |
# Text input box with a max of 1500 characters | |
text_script = st.text_area("Enter your text (max 1500 characters):", max_chars=1500) | |
# Initialize the client with the hosted model | |
client = Client("habib926653/Multilingual-TTS") | |
# Dropdown for language selection | |
language = st.selectbox("Choose Language:", ["Urdu", "English"]) # Add more languages as needed | |
# Get available speakers for the selected language | |
speakers_response = client.predict(language=language, api_name="/get_speakers") | |
# Extract speakers list | |
speakers = [choice[0] for choice in speakers_response["choices"]] | |
selected_speaker = st.selectbox("Choose Speaker:", speakers) | |
# Button to trigger the processing | |
if st.button("Generate Video"): | |
if text_script: | |
# Call the function from utils.py to process the text | |
scenes = get_scenes(text_script) | |
video_assets_folder = generate_video_assets(scenes, language, selected_speaker) | |
generated_video_path = generate_video(video_assets_folder) | |
st.video(generated_video_path) | |
else: | |
st.warning("Please enter some text to generate prompts.") | |