Spaces:
Sleeping
Sleeping
Download app.py from ayanDataleads/YTAnalyzer: direct link, hf CLI and curl.
- Browser
- Download file 1.58 kB
-
https://huggingface.co/spaces/ayanDataleads/YTAnalyzer/resolve/main/app.py
- Command line
-
hf download hf://spaces/ayanDataleads/YTAnalyzer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ayanDataleads/YTAnalyzer/resolve/main/app.py
1.58 kB
| # app.py | |
| import streamlit as st | |
| from Program_Flask import Analyze | |
| def main(): | |
| st.title("YouTube Video Analysis App") | |
| # Get the video link from the user | |
| video_link = st.text_input("Enter YouTube Video Link:") | |
| if st.button("Analyze"): | |
| # Call your analysis function | |
| analysis_result = Analyze(video_link) | |
| # Check if the analysis result is None or empty | |
| if not analysis_result: | |
| st.error("Analysis failed. Please check the provided video link.") | |
| return | |
| # Display the analysis results | |
| st.subheader("Analysis Results:") | |
| display_value("Title", analysis_result['title']) | |
| display_value("URL", analysis_result['url']) | |
| display_value("Length", f"{analysis_result['len']} seconds") | |
| display_value("Language", analysis_result['lang']) | |
| display_value("Summary", analysis_result['summary']) | |
| display_value("Sentiment", analysis_result['sentiment']) | |
| display_value("Fact or Opinion", analysis_result['foo']) | |
| display_value("Presence of Hate", analysis_result['hate']) | |
| display_value("Explanation", analysis_result['explanation']) | |
| display_value("Hate Degree", analysis_result['degree']) | |
| display_value("Part with Hate", analysis_result['part']) | |
| st.write("Transcript:") | |
| st.code(analysis_result['transcript']) | |
| def display_value(label, value): | |
| displayed_value = value if value is not None and value != '' else "N/A" | |
| st.write(f"{label}: {displayed_value}") | |
| if __name__ == "__main__": | |
| main() |