felix commited on
Commit
044bf67
1 Parent(s): b68ba51
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -180,13 +180,14 @@ def display(x, y):
180
  original_df[column] = original_df[column].apply(remove_invalid_unicode)
181
 
182
  subset_df = original_df[COLS]
183
- with open('output.json', 'w') as file:
 
184
  file.write(subset_df.to_json(orient='records'))
185
  first_50_rows = subset_df.head(20)
186
- print(first_50_rows.to_string())
187
- json_data = first_50_rows.to_json(orient='records')
188
- print(json_data) # Print JSON representation
189
- return first_50_rows
190
 
191
  INTRODUCTION_TEXT = """
192
  This is a copied space from Open Source LLM leaderboard. Instead of displaying
@@ -216,10 +217,8 @@ data = data['data']
216
 
217
  interface = gr.Interface(
218
  fn=display,
219
- inputs=[ gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text"),
220
- dummy1
221
- ],
222
- outputs=[hidden_leaderboard_table_for_search]
223
  )
224
 
225
  interface.launch()
 
180
  original_df[column] = original_df[column].apply(remove_invalid_unicode)
181
 
182
  subset_df = original_df[COLS]
183
+ output_file_path = 'output/output.json' # Adjust the path as needed
184
+ with open(output_file_path, 'w') as file:
185
  file.write(subset_df.to_json(orient='records'))
186
  first_50_rows = subset_df.head(20)
187
+ #print(first_50_rows.to_string())
188
+ #json_data = first_50_rows.to_json(orient='records')
189
+ #print(json_data) # Print JSON representation
190
+ return first_50_rows, output_file_path
191
 
192
  INTRODUCTION_TEXT = """
193
  This is a copied space from Open Source LLM leaderboard. Instead of displaying
 
217
 
218
  interface = gr.Interface(
219
  fn=display,
220
+ inputs=[gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text"), dummy1],
221
+ outputs=[hidden_leaderboard_table_for_search, gr.File(label="Download JSON")]
 
 
222
  )
223
 
224
  interface.launch()