Sayiqa commited on
Commit
e9d3c73
·
verified ·
1 Parent(s): 81a97d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -156,30 +156,30 @@ def analyze_sentiment(text):
156
  sentiment_scores = sid.polarity_scores(text)
157
  return sentiment_scores
158
 
159
- # def main():
160
- # # Check if a URL is passed as a command-line argument
161
- # if len(sys.argv) > 1:
162
- # video_url = sys.argv[1]
163
- # else:
164
- # # Use a hardcoded URL for testing if no input is provided
165
- # video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" # Replace with a valid URL
166
-
167
- # print("Fetching transcript...")
168
-
169
- # try:
170
- # transcript = get_youtube_transcript(video_url)
171
- # print("Transcript fetched successfully.")
172
-
173
- # print("Summarizing transcript...")
174
- # summary = summarize_text(transcript)
175
- # print("Summary:\n", summary)
176
-
177
- # print("Analyzing sentiment...")
178
- # sentiment = analyze_sentiment(transcript)
179
- # print("Sentiment Analysis:\n", sentiment)
180
-
181
- # except Exception as e:
182
- # print("An error occurred:", str(e))
183
 
184
  def process_youtube_video(video_url, keywords):
185
  """Process YouTube video URL and keywords for analysis."""
 
156
  sentiment_scores = sid.polarity_scores(text)
157
  return sentiment_scores
158
 
159
+ def main():
160
+ # Check if a URL is passed as a command-line argument
161
+ if len(sys.argv) > 1:
162
+ video_url = sys.argv[1]
163
+ else:
164
+ # Use a hardcoded URL for testing if no input is provided
165
+ video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" # Replace with a valid URL
166
+
167
+ print("Fetching transcript...")
168
+
169
+ try:
170
+ transcript = get_youtube_transcript(video_url)
171
+ print("Transcript fetched successfully.")
172
+
173
+ print("Summarizing transcript...")
174
+ summary = summarize_text(transcript)
175
+ print("Summary:\n", summary)
176
+
177
+ print("Analyzing sentiment...")
178
+ sentiment = analyze_sentiment(transcript)
179
+ print("Sentiment Analysis:\n", sentiment)
180
+
181
+ except Exception as e:
182
+ print("An error occurred:", str(e))
183
 
184
  def process_youtube_video(video_url, keywords):
185
  """Process YouTube video URL and keywords for analysis."""