kz-transformers commited on
Commit
2d8fd5c
·
verified ·
1 Parent(s): f9af07b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -26,14 +26,10 @@ def handle_file_upload(file):
26
  return v, file_path
27
 
28
  def submit_file(v, file_path, mn):
29
- # We remove the use of a "profile" custom type.
30
- # Instead, simply assign the model name directly.
31
  print('START SUBMITTING!!!')
32
- # In this version, we assume no authentication is necessary.
33
  new_file = v['results']
34
  new_file['model'] = mn # Directly assign the provided model name.
35
-
36
- # List of expected columns
37
  columns = [
38
  'mmlu_translated_kk', 'kk_constitution_mc', 'kk_dastur_mc',
39
  'kazakh_and_literature_unt_mc', 'kk_geography_unt_mc',
@@ -41,7 +37,6 @@ def submit_file(v, file_path, mn):
41
  'kk_english_unt_mc', 'kk_biology_unt_mc', 'kk_human_society_rights_unt_mc'
42
  ]
43
 
44
- # Process each column to extract the accuracy value.
45
  for column in columns:
46
  new_file[column] = new_file[column]['acc,none']
47
 
@@ -51,7 +46,7 @@ def submit_file(v, file_path, mn):
51
  print('WE READ FILE: ', new_file)
52
  buf = BytesIO()
53
  buf.write(json.dumps(new_file).encode('utf-8'))
54
- # Upload the processed file (assuming API is imported from src.envs)
55
  API.upload_file(
56
  path_or_fileobj=buf,
57
  path_in_repo="model_data/external/" + mn.replace('/', '__') + ".json",
@@ -352,7 +347,6 @@ if __name__ == "__main__":
352
  scheduler.start()
353
 
354
  demo_app = build_demo()
355
- demo_app.get_api_info = lambda: {}
356
 
357
  demo_app.launch(debug=True, share=False, show_api=False)
358
 
 
26
  return v, file_path
27
 
28
  def submit_file(v, file_path, mn):
 
 
29
  print('START SUBMITTING!!!')
 
30
  new_file = v['results']
31
  new_file['model'] = mn # Directly assign the provided model name.
32
+
 
33
  columns = [
34
  'mmlu_translated_kk', 'kk_constitution_mc', 'kk_dastur_mc',
35
  'kazakh_and_literature_unt_mc', 'kk_geography_unt_mc',
 
37
  'kk_english_unt_mc', 'kk_biology_unt_mc', 'kk_human_society_rights_unt_mc'
38
  ]
39
 
 
40
  for column in columns:
41
  new_file[column] = new_file[column]['acc,none']
42
 
 
46
  print('WE READ FILE: ', new_file)
47
  buf = BytesIO()
48
  buf.write(json.dumps(new_file).encode('utf-8'))
49
+ buf.seek(0) # Rewind the buffer so that its contents can be read.
50
  API.upload_file(
51
  path_or_fileobj=buf,
52
  path_in_repo="model_data/external/" + mn.replace('/', '__') + ".json",
 
347
  scheduler.start()
348
 
349
  demo_app = build_demo()
 
350
 
351
  demo_app.launch(debug=True, share=False, show_api=False)
352