Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +39 -24
src/streamlit_app.py
CHANGED
|
@@ -10,7 +10,6 @@ import logging
|
|
| 10 |
|
| 11 |
# Backend API Key Configuration
|
| 12 |
GEMINI_API_KEY = os.getenv("GEMENI_KEY")
|
| 13 |
-
print(GEMINI_API_KEY)
|
| 14 |
|
| 15 |
# Page configuration
|
| 16 |
st.set_page_config(
|
|
@@ -397,6 +396,16 @@ def main():
|
|
| 397 |
type="primary",
|
| 398 |
use_container_width=True
|
| 399 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
|
| 401 |
# Main content area
|
| 402 |
if uploaded_video is None:
|
|
@@ -444,33 +453,39 @@ def main():
|
|
| 444 |
)
|
| 445 |
|
| 446 |
if json_response:
|
|
|
|
|
|
|
| 447 |
st.success("Analysis complete! Here are your script variations:")
|
| 448 |
-
|
| 449 |
-
# Create tabs for different outputs
|
| 450 |
-
tab1, tab2, tab3 = st.tabs(["Script Variations", "Video Analysis", "Improvement Recommendations"])
|
| 451 |
-
|
| 452 |
-
with tab1:
|
| 453 |
-
display_script_variations(json_response)
|
| 454 |
-
|
| 455 |
-
# CSV Download button
|
| 456 |
-
csv_content = create_csv_download(json_response)
|
| 457 |
-
st.download_button(
|
| 458 |
-
label="Download All Scripts (CSV)",
|
| 459 |
-
data=csv_content,
|
| 460 |
-
file_name="video_script_variations.csv",
|
| 461 |
-
mime="text/csv",
|
| 462 |
-
type="secondary",
|
| 463 |
-
use_container_width=True
|
| 464 |
-
)
|
| 465 |
-
|
| 466 |
-
with tab2:
|
| 467 |
-
display_video_analysis(json_response)
|
| 468 |
-
|
| 469 |
-
with tab3:
|
| 470 |
-
display_timestamp_improvements(json_response)
|
| 471 |
else:
|
| 472 |
st.error("Failed to generate script variations. Please try again.")
|
| 473 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
else:
|
| 475 |
st.info("Configure your inputs in the sidebar and click 'Generate Script Variations' to begin.")
|
| 476 |
|
|
|
|
| 10 |
|
| 11 |
# Backend API Key Configuration
|
| 12 |
GEMINI_API_KEY = os.getenv("GEMENI_KEY")
|
|
|
|
| 13 |
|
| 14 |
# Page configuration
|
| 15 |
st.set_page_config(
|
|
|
|
| 396 |
type="primary",
|
| 397 |
use_container_width=True
|
| 398 |
)
|
| 399 |
+
|
| 400 |
+
# Clear results button (only show if results exist)
|
| 401 |
+
if "analysis_results" in st.session_state and st.session_state["analysis_results"]:
|
| 402 |
+
if st.button(
|
| 403 |
+
"Clear Results",
|
| 404 |
+
type="secondary",
|
| 405 |
+
use_container_width=True
|
| 406 |
+
):
|
| 407 |
+
del st.session_state["analysis_results"]
|
| 408 |
+
st.rerun()
|
| 409 |
|
| 410 |
# Main content area
|
| 411 |
if uploaded_video is None:
|
|
|
|
| 453 |
)
|
| 454 |
|
| 455 |
if json_response:
|
| 456 |
+
# Store results in session state
|
| 457 |
+
st.session_state["analysis_results"] = json_response
|
| 458 |
st.success("Analysis complete! Here are your script variations:")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
else:
|
| 460 |
st.error("Failed to generate script variations. Please try again.")
|
| 461 |
|
| 462 |
+
# Display results if they exist in session state
|
| 463 |
+
if "analysis_results" in st.session_state and st.session_state["analysis_results"]:
|
| 464 |
+
json_response = st.session_state["analysis_results"]
|
| 465 |
+
|
| 466 |
+
# Create tabs for different outputs
|
| 467 |
+
tab1, tab2, tab3 = st.tabs(["Script Variations", "Video Analysis", "Improvement Recommendations"])
|
| 468 |
+
|
| 469 |
+
with tab1:
|
| 470 |
+
display_script_variations(json_response)
|
| 471 |
+
|
| 472 |
+
# CSV Download button
|
| 473 |
+
csv_content = create_csv_download(json_response)
|
| 474 |
+
st.download_button(
|
| 475 |
+
label="Download All Scripts (CSV)",
|
| 476 |
+
data=csv_content,
|
| 477 |
+
file_name="video_script_variations.csv",
|
| 478 |
+
mime="text/csv",
|
| 479 |
+
type="secondary",
|
| 480 |
+
use_container_width=True
|
| 481 |
+
)
|
| 482 |
+
|
| 483 |
+
with tab2:
|
| 484 |
+
display_video_analysis(json_response)
|
| 485 |
+
|
| 486 |
+
with tab3:
|
| 487 |
+
display_timestamp_improvements(json_response)
|
| 488 |
+
|
| 489 |
else:
|
| 490 |
st.info("Configure your inputs in the sidebar and click 'Generate Script Variations' to begin.")
|
| 491 |
|