Arjon07CSE commited on
Commit
b4029da
·
verified ·
1 Parent(s): cc763e1

solved the youtube conflicts

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -714,25 +714,29 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="orange"),
714
  )
715
 
716
  def update_youtube_dashboards(results_data):
 
717
  if not results_data or results_data.get("full_scan") is None or results_data["full_scan"].empty:
718
- return [gr.update(visible=False), "0", "0", "0", "0", None, None, None, None, None, None, None]
 
719
  videos_df_full, comments_df, total_estimate = results_data.get("full_scan"), results_data.get("comments"), results_data.get("total_estimate", 0)
720
  deep_dive_updates = generate_youtube_dashboard(videos_df_full, comments_df)
721
  fig_ch_views, fig_quad, fig_age = generate_youtube_topic_dashboard(videos_df_full)
722
- # Return outputs in the exact order of yt_ui_components
 
723
  return [
724
  gr.update(visible=True),
725
  f"{total_estimate:,}",
726
  deep_dive_updates.get(kpi_yt_videos_found, "0"),
727
  deep_dive_updates.get(kpi_yt_views_scanned, "0"),
728
  deep_dive_updates.get(kpi_yt_comments_scraped, "0"),
729
- deep_dive_updates.get(yt_channel_plot, None),
730
- deep_dive_updates.get(yt_wordcloud_plot, None),
731
- deep_dive_updates.get(yt_sentiment_pie_plot, None),
732
- deep_dive_updates.get(yt_sentiment_by_video_plot, None),
733
  fig_ch_views,
734
  fig_quad,
735
- fig_age
 
 
 
736
  ]
737
 
738
  yt_ui_components = [
 
714
  )
715
 
716
  def update_youtube_dashboards(results_data):
717
+ # If there are no results, return the correct number of empty items (13 in this case)
718
  if not results_data or results_data.get("full_scan") is None or results_data["full_scan"].empty:
719
+ return [gr.update(visible=False), "0", "0", "0", "0", None, None, None, None, None, None, None, None]
720
+
721
  videos_df_full, comments_df, total_estimate = results_data.get("full_scan"), results_data.get("comments"), results_data.get("total_estimate", 0)
722
  deep_dive_updates = generate_youtube_dashboard(videos_df_full, comments_df)
723
  fig_ch_views, fig_quad, fig_age = generate_youtube_topic_dashboard(videos_df_full)
724
+
725
+ # This return statement now provides a "picture" for every "frame" in the corrected list.
726
  return [
727
  gr.update(visible=True),
728
  f"{total_estimate:,}",
729
  deep_dive_updates.get(kpi_yt_videos_found, "0"),
730
  deep_dive_updates.get(kpi_yt_views_scanned, "0"),
731
  deep_dive_updates.get(kpi_yt_comments_scraped, "0"),
732
+ deep_dive_updates.get('yt_channel_plot', None),
733
+ deep_dive_updates.get('yt_wordcloud_plot', None),
 
 
734
  fig_ch_views,
735
  fig_quad,
736
+ fig_age,
737
+ deep_dive_updates.get('yt_top_videos_plot', None),
738
+ deep_dive_updates.get('yt_engagement_plot', None),
739
+ deep_dive_updates.get('yt_comment_activity_plot', None)
740
  ]
741
 
742
  yt_ui_components = [