hecl commited on
Commit
3ca4672
1 Parent(s): 53d2dc8

- [MINOR] [SOURCE] [UPDATE] 1. update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -10
app.py CHANGED
@@ -71,11 +71,8 @@ def compare_score(score, score_list):
71
  return f"Better than {percentage:.0f}% videos in YT-UGC" if percentage > 50 else f"Worse than {100-percentage:.0f}% videos in YT-UGC"
72
 
73
  def create_bar_chart(scores, comparisons):
74
- labels = ['Semantic', 'Aesthetic', 'Technical', 'Overall']
75
- base_colors = ['#d62728', '#ff7f0e', '#1f77b4', '#bcbd22']
76
-
77
- # Ensure comparisons are float arrays
78
- comparisons = [np.array(comparison, dtype=float) for comparison in comparisons]
79
 
80
  fig, ax = plt.subplots(figsize=(8, 6))
81
 
@@ -93,12 +90,8 @@ def create_bar_chart(scores, comparisons):
93
  color='black')
94
 
95
  # Add comparison text
96
- comparison_texts = []
97
  for i, (bar, score) in enumerate(zip(bars, scores)):
98
- percentage = (np.sum(comparisons[i] < score) / len(comparisons[i])) * 100
99
- comparison_text = f'Better than {percentage:.0f}% videos in YT-UGC' if percentage > 50 else f'Worse than {100 - percentage:.0f}% videos in YT-UGC'
100
- comparison_texts.append(comparison_text)
101
- ax.annotate(comparison_text,
102
  xy=(bar.get_x() + bar.get_width(), bar.get_height() / 2),
103
  xytext=(5, 0), # 5 points horizontal offset
104
  textcoords="offset points",
 
71
  return f"Better than {percentage:.0f}% videos in YT-UGC" if percentage > 50 else f"Worse than {100-percentage:.0f}% videos in YT-UGC"
72
 
73
  def create_bar_chart(scores, comparisons):
74
+ labels = ['Semantic', 'Technical', 'Aesthetic', 'Overall']
75
+ base_colors = ['#d62728', '#1f77b4', '#ff7f0e', '#bcbd22']
 
 
 
76
 
77
  fig, ax = plt.subplots(figsize=(8, 6))
78
 
 
90
  color='black')
91
 
92
  # Add comparison text
 
93
  for i, (bar, score) in enumerate(zip(bars, scores)):
94
+ ax.annotate(comparisons[i],
 
 
 
95
  xy=(bar.get_x() + bar.get_width(), bar.get_height() / 2),
96
  xytext=(5, 0), # 5 points horizontal offset
97
  textcoords="offset points",