chinmayc3 commited on
Commit
5abd25c
·
1 Parent(s): 3c7fcae

fixed issue to allow multiple transcription on one file

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py CHANGED
@@ -63,6 +63,37 @@ class ResultWriter:
63
  df = pd.DataFrame(columns=self.headers)
64
  df.to_csv(f, index=False)
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  def write_result(self,user_email ,audio_path,option_1_duration_info,option_2_duration_info ,winner_model=None, loser_model=None, both_preferred=False, none_preferred=False):
67
  result = {
68
  'email': user_email,
@@ -274,6 +305,7 @@ def on_click_transcribe():
274
  st.session_state.transcribed = True
275
  st.session_state.option_1_model_name_state = ""
276
  st.session_state.option_2_model_name_state = ""
 
277
 
278
  def on_random_click():
279
  reset_state()
 
63
  df = pd.DataFrame(columns=self.headers)
64
  df.to_csv(f, index=False)
65
 
66
+ def expected_rating(self, rating_a, rating_b):
67
+ return 1 / (1 + 10 ** ((rating_a - rating_b) / 400))
68
+
69
+
70
+ def updateElo(self,rating_a, rating_b, outcome, baseKFactor):
71
+ # Calculate the rating difference
72
+ ratingDiff = abs(rating_a - rating_b)
73
+
74
+ if ratingDiff > 25:
75
+ kFactor = baseKFactor + 10
76
+ else:
77
+ kFactor = baseKFactor
78
+
79
+ expectedA = self.expected_rating(rating_a, rating_b)
80
+ expectedB = self.expected_rating(rating_b, rating_a)
81
+
82
+ if outcome == 'win':
83
+ scoreA = 1
84
+ scoreB = 0
85
+ elif outcome == 'tie':
86
+ scoreA = 0.5
87
+ scoreB = 0.5
88
+ else: # no_result
89
+ # No change in ratings for no result
90
+ return rating_a, rating_b
91
+
92
+ newRatingA = rating_a + kFactor * (scoreA - expectedA)
93
+ newRatingB = rating_b + kFactor * (scoreB - expectedB)
94
+
95
+ return round(newRatingA, 3), round(newRatingB, 3)
96
+
97
  def write_result(self,user_email ,audio_path,option_1_duration_info,option_2_duration_info ,winner_model=None, loser_model=None, both_preferred=False, none_preferred=False):
98
  result = {
99
  'email': user_email,
 
305
  st.session_state.transcribed = True
306
  st.session_state.option_1_model_name_state = ""
307
  st.session_state.option_2_model_name_state = ""
308
+ st.session_state.option_selected = None
309
 
310
  def on_random_click():
311
  reset_state()