File size: 1,133 Bytes
0b739c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from transformers import pipeline

# Load the model
model_name = "vrgamedevgirl84/Wan14BT2VFusioniX"
text2video = pipeline("text-to-video", model=model_name)

st.title("Text to Video Generator")
st.write("Enter your text below or upload a text file:")

# Option to upload a text file
uploaded_file = st.file_uploader("Upload a text file", type=["txt"])

# Text input area
text_input = st.text_area("Or type your text here:")

# Combine file content and text input
if uploaded_file:
    file_text = uploaded_file.read().decode("utf-8")
    st.write("File content loaded.")
else:
    file_text = ""

# Generate button
if st.button("Generate Video"):
    # Use the uploaded file content if available, else use text input
    input_text = file_text if file_text else text_input
    if input_text.strip() == "":
        st.warning("Please enter some text or upload a file.")
    else:
        with st.spinner("Generating video..."):
            # Generate video
            video_path = text2video(input_text)[0]  # Adjust depending on model's output
            # Display the video
            st.video(video_path)