-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
89 lines (75 loc) · 2.29 KB
/
app.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import streamlit as st
from chatbot import chat
import os
import time
st.title("Simplify Reels")
# page_bg_img = """<style>
# [data-testid="stAppViewContainer"]
# { background-image: url("https://images.unsplash.com/photo-1542281286-9e0a16bb7366");
# background-size: cover; }
# </style>"""
# st.markdown(page_bg_img, unsafe_allow_html=True)
def local_css():
st.markdown("""
<style>
/* Background */
[data-testid="stAppViewContainer"] {
background-color: #3E2723; /* Dark Brown */
color: #F5F5F5; /* Light Gray for text */
}
/* Sidebar */
[data-testid="stSidebar"] {
background-color: #4E342E; /* Slightly lighter brown */
}
/* Title */
h1 {
color: #FF6F00; /* Orange */
font-family: 'Cinzel', serif; /* Western-style font */
text-align: center;
text-shadow: 2px 2px #000000;
}
/* Chat Input */
.css-1r6slb0 {
background-color: #5D4037; /* Brown */
color: #F5F5F5;
}
/* Buttons */
.css-1emrehy.edgvbvh3 {
background-color: #BF360C; /* Deep Orange */
color: #FFF3E0;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-family: 'Cinzel', serif;
box-shadow: 2px 2px #000000;
}
white-text {
color: white
}
/* Footer */
footer {
visibility: hidden;
}
/* Import Google Font */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&display=swap');
</style>
""", unsafe_allow_html=True)
local_css()
# Add a greeting message
if 'greeted' not in st.session_state:
with st.chat_message("🤠"):
st.write(f":orange[Howdy, partner! Tell me a story and I'll turn it into a video for you.]")
st.session_state['greeted'] = True
video_file = "output_video.mp4"
# Handle user input
prompt = st.chat_input("Once upon a time...")
if prompt:
# Remove the existing video file if it exists
if os.path.exists(video_file):
os.remove(video_file)
last_modified_time = None
with st.spinner("Generating your queries..."): # Show loading spinner
chat(prompt) # Creates chat_output.txt
with st.spinner("Generating your video..."):
time.sleep(60)
st.video(video_file)