AiCoderv2 commited on
Commit
0b739c4
·
verified ·
1 Parent(s): c17dc0c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Load the model
5
+ model_name = "vrgamedevgirl84/Wan14BT2VFusioniX"
6
+ text2video = pipeline("text-to-video", model=model_name)
7
+
8
+ st.title("Text to Video Generator")
9
+ st.write("Enter your text below or upload a text file:")
10
+
11
+ # Option to upload a text file
12
+ uploaded_file = st.file_uploader("Upload a text file", type=["txt"])
13
+
14
+ # Text input area
15
+ text_input = st.text_area("Or type your text here:")
16
+
17
+ # Combine file content and text input
18
+ if uploaded_file:
19
+ file_text = uploaded_file.read().decode("utf-8")
20
+ st.write("File content loaded.")
21
+ else:
22
+ file_text = ""
23
+
24
+ # Generate button
25
+ if st.button("Generate Video"):
26
+ # Use the uploaded file content if available, else use text input
27
+ input_text = file_text if file_text else text_input
28
+ if input_text.strip() == "":
29
+ st.warning("Please enter some text or upload a file.")
30
+ else:
31
+ with st.spinner("Generating video..."):
32
+ # Generate video
33
+ video_path = text2video(input_text)[0] # Adjust depending on model's output
34
+ # Display the video
35
+ st.video(video_path)