Update app.py
Browse files
app.py
CHANGED
@@ -31,12 +31,13 @@ def formatter(x):
|
|
31 |
else:
|
32 |
return round(x, 2)
|
33 |
|
|
|
34 |
for col in original_df.columns:
|
35 |
-
if col
|
36 |
-
|
37 |
else:
|
38 |
original_df[col] = original_df[col].apply(formatter)
|
39 |
-
|
40 |
original_df.rename(columns=column_names, inplace=True)
|
41 |
original_df.sort_values(by='WER ⬇️', inplace=True)
|
42 |
|
@@ -51,8 +52,8 @@ def request_model(model_text):
|
|
51 |
if not base_model_on_hub:
|
52 |
return styled_error(f"Base model '{model_text}' {error_msg}")
|
53 |
|
54 |
-
# Check if the model has already been evaluated
|
55 |
-
if model_text in original_df['
|
56 |
return styled_error(f"The model '{model_text}' is already in the leaderboard.")
|
57 |
|
58 |
try:
|
@@ -74,7 +75,7 @@ def request_model(model_text):
|
|
74 |
pipe = pipeline(
|
75 |
"automatic-speech-recognition",
|
76 |
model=model_text,
|
77 |
-
torch_dtype=torch.
|
78 |
device=0 if torch.cuda.is_available() else -1, # Use GPU if available
|
79 |
)
|
80 |
|
@@ -111,12 +112,14 @@ def request_model(model_text):
|
|
111 |
df_results.to_csv(csv_results, index=False)
|
112 |
|
113 |
# Update the leaderboard DataFrame
|
114 |
-
|
115 |
original_df = df_results.copy()
|
116 |
-
original_df['Model'] = original_df['model'].apply(
|
117 |
-
|
118 |
-
|
119 |
-
|
|
|
|
|
|
|
120 |
original_df.sort_values(by='WER ⬇️', inplace=True)
|
121 |
|
122 |
# Update the leaderboard table in the UI
|
|
|
31 |
else:
|
32 |
return round(x, 2)
|
33 |
|
34 |
+
# Apply formatting to other columns
|
35 |
for col in original_df.columns:
|
36 |
+
if col in ['model', 'Model']:
|
37 |
+
continue # Skip the 'model' and 'Model' columns
|
38 |
else:
|
39 |
original_df[col] = original_df[col].apply(formatter)
|
40 |
+
|
41 |
original_df.rename(columns=column_names, inplace=True)
|
42 |
original_df.sort_values(by='WER ⬇️', inplace=True)
|
43 |
|
|
|
52 |
if not base_model_on_hub:
|
53 |
return styled_error(f"Base model '{model_text}' {error_msg}")
|
54 |
|
55 |
+
# Check if the model has already been evaluated using the raw 'model' column
|
56 |
+
if model_text in original_df['model'].values:
|
57 |
return styled_error(f"The model '{model_text}' is already in the leaderboard.")
|
58 |
|
59 |
try:
|
|
|
75 |
pipe = pipeline(
|
76 |
"automatic-speech-recognition",
|
77 |
model=model_text,
|
78 |
+
torch_dtype=torch.float16,
|
79 |
device=0 if torch.cuda.is_available() else -1, # Use GPU if available
|
80 |
)
|
81 |
|
|
|
112 |
df_results.to_csv(csv_results, index=False)
|
113 |
|
114 |
# Update the leaderboard DataFrame
|
|
|
115 |
original_df = df_results.copy()
|
116 |
+
original_df['Model'] = original_df['model'].apply(make_clickable_model)
|
117 |
+
for col in original_df.columns:
|
118 |
+
if col in ['model', 'Model']:
|
119 |
+
continue # Skip the 'model' and 'Model' columns
|
120 |
+
else:
|
121 |
+
original_df[col] = original_df[col].apply(formatter)
|
122 |
+
original_df.rename(columns=column_names, inplace=True)
|
123 |
original_df.sort_values(by='WER ⬇️', inplace=True)
|
124 |
|
125 |
# Update the leaderboard table in the UI
|