conhllnd commited on
Commit
e313b64
·
verified ·
1 Parent(s): 1436d49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -1
app.py CHANGED
@@ -16,6 +16,22 @@ facebook_csv_path = "facebook_histogram.csv"
16
  video_folder = "videos"
17
  image_folder = "images"
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  # Function to extract the prediction label from filenames
20
  def extract_prediction_label(filename, media_type):
21
  if media_type == "video":
@@ -164,7 +180,18 @@ def calculate_engagement_increase():
164
 
165
  # Create the Gradio interface
166
  with gr.Blocks() as dashboard:
167
-
 
 
 
 
 
 
 
 
 
 
 
168
  # Add a header for follower impact
169
  gr.Markdown("## Leonardo's Follower Impact")
170
 
 
16
  video_folder = "videos"
17
  image_folder = "images"
18
 
19
+ # Function to load and plot the masterpiece data (video and graph)
20
+ def load_masterpiece_video_and_plot():
21
+ masterpiece_video_path = os.path.join(video_folder, "starperformer_viral.mp4")
22
+
23
+ # Assuming 'viral' is the actual outcome from the video filename
24
+ actual_outcome = "viral"
25
+
26
+ # Load the TikTok engagement data from the CSV
27
+ fig, x_min, x_max, y_min, y_max = load_and_plot_csv(tiktok_csv_path)
28
+
29
+ # Highlight the quintile based on the actual outcome 'viral'
30
+ fig = highlight_quintile(fig, actual_outcome, x_max)
31
+
32
+ return masterpiece_video_path, fig
33
+
34
+
35
  # Function to extract the prediction label from filenames
36
  def extract_prediction_label(filename, media_type):
37
  if media_type == "video":
 
180
 
181
  # Create the Gradio interface
182
  with gr.Blocks() as dashboard:
183
+ # Section for Leonardo's Last-Week Masterpiece
184
+ gr.Markdown("# Leonardo's Masterpiece from Last Week")
185
+
186
+ # Load the masterpiece video and graph
187
+ masterpiece_video, masterpiece_graph = load_masterpiece_video_and_plot()
188
+
189
+ # Display the video
190
+ gr.Video(masterpiece_video, label="Star Performer TikTok Video")
191
+
192
+ # Display the graph with quintile highlighting
193
+ gr.Plot(masterpiece_graph, label="Star Performer TikTok Performance")
194
+
195
  # Add a header for follower impact
196
  gr.Markdown("## Leonardo's Follower Impact")
197