File size: 1,583 Bytes
f283a7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 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()