Spaces:
Runtime error
Runtime error
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) |