File size: 1,324 Bytes
e98f22b
 
 
 
 
 
 
b3d9d61
e98f22b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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.")