Spaces:
Sleeping
Sleeping
Commit ·
f283a7b
1
Parent(s): 97ed0ae
app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
import streamlit as st
|
| 3 |
+
from Program_Flask import Analyze
|
| 4 |
+
|
| 5 |
+
def main():
|
| 6 |
+
st.title("YouTube Video Analysis App")
|
| 7 |
+
|
| 8 |
+
# Get the video link from the user
|
| 9 |
+
video_link = st.text_input("Enter YouTube Video Link:")
|
| 10 |
+
|
| 11 |
+
if st.button("Analyze"):
|
| 12 |
+
# Call your analysis function
|
| 13 |
+
analysis_result = Analyze(video_link)
|
| 14 |
+
|
| 15 |
+
# Check if the analysis result is None or empty
|
| 16 |
+
if not analysis_result:
|
| 17 |
+
st.error("Analysis failed. Please check the provided video link.")
|
| 18 |
+
return
|
| 19 |
+
|
| 20 |
+
# Display the analysis results
|
| 21 |
+
st.subheader("Analysis Results:")
|
| 22 |
+
display_value("Title", analysis_result['title'])
|
| 23 |
+
display_value("URL", analysis_result['url'])
|
| 24 |
+
display_value("Length", f"{analysis_result['len']} seconds")
|
| 25 |
+
display_value("Language", analysis_result['lang'])
|
| 26 |
+
display_value("Summary", analysis_result['summary'])
|
| 27 |
+
display_value("Sentiment", analysis_result['sentiment'])
|
| 28 |
+
display_value("Fact or Opinion", analysis_result['foo'])
|
| 29 |
+
display_value("Presence of Hate", analysis_result['hate'])
|
| 30 |
+
display_value("Explanation", analysis_result['explanation'])
|
| 31 |
+
display_value("Hate Degree", analysis_result['degree'])
|
| 32 |
+
display_value("Part with Hate", analysis_result['part'])
|
| 33 |
+
|
| 34 |
+
st.write("Transcript:")
|
| 35 |
+
st.code(analysis_result['transcript'])
|
| 36 |
+
|
| 37 |
+
def display_value(label, value):
|
| 38 |
+
displayed_value = value if value is not None and value != '' else "N/A"
|
| 39 |
+
st.write(f"{label}: {displayed_value}")
|
| 40 |
+
|
| 41 |
+
if __name__ == "__main__":
|
| 42 |
+
main()
|