Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from gradio_client import Client
|
| 3 |
from utils import get_scenes, generate_video_assets, generate_video # Import the function from utils.py
|
| 4 |
|
| 5 |
-
#
|
| 6 |
st.markdown(
|
| 7 |
"<h1 style='text-align: center;'>Text to Video Generator</h1>",
|
| 8 |
unsafe_allow_html=True
|
| 9 |
-
|
| 10 |
|
| 11 |
st.markdown("<p style='text-align: center;'>Leave a Like if it works for you! ❤️</p>", unsafe_allow_html=True)
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
text_script = st.text_area("Enter your script/story (max 1500 characters):", max_chars=1500)
|
| 15 |
|
| 16 |
-
|
| 17 |
# Initialize the client with the hosted model
|
| 18 |
client = Client("habib926653/Multilingual-TTS")
|
| 19 |
|
|
@@ -27,8 +49,6 @@ speakers_response = client.predict(language=language, api_name="/get_speakers")
|
|
| 27 |
speakers = [choice[0] for choice in speakers_response["choices"]]
|
| 28 |
selected_speaker = st.selectbox("Choose Speaker:", speakers)
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
# Button to trigger the processing
|
| 33 |
if st.button("Generate Video"):
|
| 34 |
if text_script:
|
|
|
|
| 1 |
+
#
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
|
| 6 |
import streamlit as st
|
| 7 |
from gradio_client import Client
|
| 8 |
from utils import get_scenes, generate_video_assets, generate_video # Import the function from utils.py
|
| 9 |
|
| 10 |
+
# Title
|
| 11 |
st.markdown(
|
| 12 |
"<h1 style='text-align: center;'>Text to Video Generator</h1>",
|
| 13 |
unsafe_allow_html=True
|
| 14 |
+
)
|
| 15 |
|
| 16 |
st.markdown("<p style='text-align: center;'>Leave a Like if it works for you! ❤️</p>", unsafe_allow_html=True)
|
| 17 |
|
| 18 |
+
# Example Section - Placed before the input box
|
| 19 |
+
st.markdown("### 🔥 See How It Works (Example)")
|
| 20 |
+
|
| 21 |
+
# Example video (Replace 'example_video.mp4' with your actual file path or URL)
|
| 22 |
+
example_video_path = "example_video.mp4" # Change to your actual video file
|
| 23 |
+
st.video(example_video_path)
|
| 24 |
+
|
| 25 |
+
# Example script in an expandable section
|
| 26 |
+
with st.expander("📜 View Example Script"):
|
| 27 |
+
st.markdown("""
|
| 28 |
+
**Title:** The Lost Book
|
| 29 |
+
**Script:**
|
| 30 |
+
کاشف ہمیشہ اپنے معمولات میں مگن رہتا تھا، مگر ایک دن سب کچھ بدل گیا۔
|
| 31 |
+
وہ اپنے لائبریری میں بیٹھا کتابیں پڑھ رہا تھا جب اچانک اس کی نظر ایک پرانی کتاب پر پڑی،
|
| 32 |
+
جو اسے کبھی دیکھی نہیں تھی۔ کتاب کھولتے ہی ایک گہری روشنی نکل آئی...
|
| 33 |
+
""")
|
| 34 |
+
|
| 35 |
+
# Text input box with a max of 1500 characters
|
| 36 |
+
st.markdown("### ✍️ Create Your Own Video")
|
| 37 |
text_script = st.text_area("Enter your script/story (max 1500 characters):", max_chars=1500)
|
| 38 |
|
|
|
|
| 39 |
# Initialize the client with the hosted model
|
| 40 |
client = Client("habib926653/Multilingual-TTS")
|
| 41 |
|
|
|
|
| 49 |
speakers = [choice[0] for choice in speakers_response["choices"]]
|
| 50 |
selected_speaker = st.selectbox("Choose Speaker:", speakers)
|
| 51 |
|
|
|
|
|
|
|
| 52 |
# Button to trigger the processing
|
| 53 |
if st.button("Generate Video"):
|
| 54 |
if text_script:
|