pandora-s commited on
Commit
8055d0a
1 Parent(s): f570858

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -43,14 +43,15 @@ def update_data():
43
  data = get_available_free()
44
  df = pd.DataFrame(data)
45
 
46
- def custom_sort_status(status):
47
- if status == "⌀":
48
- return 1
49
- elif status == "✓":
50
- return 0
51
- else:
52
- return 2
53
- df = df.sort_values(by=['API', 'Text Completion', 'Chat Completion'], key=lambda x: (x.map(custom_sort_status), x))
 
54
 
55
  return df
56
 
 
43
  data = get_available_free()
44
  df = pd.DataFrame(data)
45
 
46
+ status_mapping = {"✓": 0, "⌀": 1, "---": 2}
47
+
48
+ df['Text Completion'] = df['Text Completion'].map(status_mapping)
49
+ df['Chat Completion'] = df['Chat Completion'].map(status_mapping)
50
+
51
+ df = df.sort_values(by=['API', 'Text Completion', 'Chat Completion'])
52
+
53
+ df['Text Completion'] = df['Text Completion'].map({v: k for k, v in status_mapping.items()})
54
+ df['Chat Completion'] = df['Chat Completion'].map({v: k for k, v in status_mapping.items()})
55
 
56
  return df
57