felix commited on
Commit
e98a91e
1 Parent(s): 2b3e2c8
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -147,18 +147,36 @@ def filter_models(
147
  return filtered_df
148
 
149
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
  dummy1 = gr.Textbox(visible=False)
152
 
153
  hidden_leaderboard_table_for_search = gr.components.Dataframe(
154
  headers=COLS,
155
  datatype=TYPES,
156
- visible=False
 
 
157
  )
158
 
159
  def display(x, y):
160
- json_data = original_df.to_json(orient='records')
161
- print(json_data) # Print JSON representation
 
 
 
 
162
  return original_df
163
 
164
  INTRODUCTION_TEXT = """
 
147
  return filtered_df
148
 
149
 
150
+ import unicodedata
151
+
152
+ def is_valid_unicode(char):
153
+ try:
154
+ unicodedata.name(char)
155
+ return True # Valid Unicode character
156
+ except ValueError:
157
+ return False # Invalid Unicode character
158
+
159
+ def remove_invalid_unicode(input_string):
160
+ valid_chars = [char for char in input_string if is_valid_unicode(char)]
161
+ return ''.join(valid_chars)
162
 
163
  dummy1 = gr.Textbox(visible=False)
164
 
165
  hidden_leaderboard_table_for_search = gr.components.Dataframe(
166
  headers=COLS,
167
  datatype=TYPES,
168
+ visible=False,
169
+ line_breaks=False,
170
+ interactive=False
171
  )
172
 
173
  def display(x, y):
174
+ # Assuming df is your DataFrame
175
+ for column in original_df.columns:
176
+ if original_df[column].dtype == 'object':
177
+ original_df[column] = original_df[column].apply(remove_invalid_unicode)
178
+ #json_data = original_df.to_json(orient='records')
179
+ #print(json_data) # Print JSON representation
180
  return original_df
181
 
182
  INTRODUCTION_TEXT = """