Spaces:
Build error
Build error
Paul Ke commited on
Update streamlit_app.py
Browse files- streamlit_app.py +14 -15
streamlit_app.py
CHANGED
|
@@ -163,7 +163,18 @@ if st.session_state["videos"]:
|
|
| 163 |
st.sidebar.video(st.session_state["videos"])
|
| 164 |
except Exception as e:
|
| 165 |
st.write("Couldn't show video")
|
| 166 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
# Analysis prompt
|
| 168 |
analysis_prompt = st.sidebar.text_area("Enter analysis")
|
| 169 |
|
|
@@ -172,7 +183,7 @@ if st.button('Generate the story'):
|
|
| 172 |
try:
|
| 173 |
with st.spinner("Generating the story of the video"):
|
| 174 |
# Upload and process the video
|
| 175 |
-
processed_video = upload_file(
|
| 176 |
while processed_video.state.name == "PROCESSING":
|
| 177 |
time.sleep(1)
|
| 178 |
processed_video = get_file(processed_video.name)
|
|
@@ -184,16 +195,4 @@ if st.button('Generate the story'):
|
|
| 184 |
st.markdown(response.content)
|
| 185 |
|
| 186 |
except Exception as error:
|
| 187 |
-
st.sidebar.error(f"An error occurred: {error}")
|
| 188 |
-
|
| 189 |
-
try:
|
| 190 |
-
video_file = open(st.session_state["videos"], "rb")
|
| 191 |
-
st.sidebar.download_button(
|
| 192 |
-
"**Download Video π**",
|
| 193 |
-
data=video_file,
|
| 194 |
-
file_name=f"{st.session_state['videos'].lower().translate(str.maketrans('', '', string.punctuation)).replace(' ', '_')}.mp4",
|
| 195 |
-
mime="video/mp4",
|
| 196 |
-
type="primary",
|
| 197 |
-
)
|
| 198 |
-
except Exception as e:
|
| 199 |
-
st.error("Failed downloading the video", icon="π")
|
|
|
|
| 163 |
st.sidebar.video(st.session_state["videos"])
|
| 164 |
except Exception as e:
|
| 165 |
st.write("Couldn't show video")
|
| 166 |
+
try:
|
| 167 |
+
video_file = open(st.session_state["videos"], "rb")
|
| 168 |
+
st.sidebar.download_button(
|
| 169 |
+
"**Download Video π**",
|
| 170 |
+
data=video_file,
|
| 171 |
+
file_name=f"{st.session_state['videos'].lower().translate(str.maketrans('', '', string.punctuation)).replace(' ', '_')}.mp4",
|
| 172 |
+
mime="video/mp4",
|
| 173 |
+
type="primary",
|
| 174 |
+
)
|
| 175 |
+
except Exception as e:
|
| 176 |
+
st.error("Failed downloading the video", icon="π")
|
| 177 |
+
|
| 178 |
# Analysis prompt
|
| 179 |
analysis_prompt = st.sidebar.text_area("Enter analysis")
|
| 180 |
|
|
|
|
| 183 |
try:
|
| 184 |
with st.spinner("Generating the story of the video"):
|
| 185 |
# Upload and process the video
|
| 186 |
+
processed_video = upload_file(video_file)
|
| 187 |
while processed_video.state.name == "PROCESSING":
|
| 188 |
time.sleep(1)
|
| 189 |
processed_video = get_file(processed_video.name)
|
|
|
|
| 195 |
st.markdown(response.content)
|
| 196 |
|
| 197 |
except Exception as error:
|
| 198 |
+
st.sidebar.error(f"An error occurred: {error}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|