Terry Zhuo
commited on
Commit
·
ad443d7
1
Parent(s):
bed6bef
update
Browse files
app.py
CHANGED
@@ -29,7 +29,7 @@ def load_stats():
|
|
29 |
last_update = f.read().strip()
|
30 |
return df, last_update
|
31 |
except (FileNotFoundError, pd.errors.EmptyDataError):
|
32 |
-
return pd.DataFrame(columns=['
|
33 |
|
34 |
def update_stats():
|
35 |
"""Get the latest battle statistics"""
|
@@ -41,7 +41,7 @@ def update_stats():
|
|
41 |
ip_counts = count_files_per_ip(reader)
|
42 |
|
43 |
# Convert to DataFrame for better display
|
44 |
-
df = pd.DataFrame(list(ip_counts.items()), columns=['
|
45 |
df = df.sort_values('Battle Count', ascending=False)
|
46 |
|
47 |
# Get current time
|
@@ -53,7 +53,7 @@ def update_stats():
|
|
53 |
return df, current_time
|
54 |
except Exception as e:
|
55 |
print(f"Error updating stats: {e}")
|
56 |
-
return pd.DataFrame(columns=['
|
57 |
|
58 |
def auto_update(state):
|
59 |
"""Background task to update stats every hour"""
|
|
|
29 |
last_update = f.read().strip()
|
30 |
return df, last_update
|
31 |
except (FileNotFoundError, pd.errors.EmptyDataError):
|
32 |
+
return pd.DataFrame(columns=['Annotator', 'Battle Count']), ""
|
33 |
|
34 |
def update_stats():
|
35 |
"""Get the latest battle statistics"""
|
|
|
41 |
ip_counts = count_files_per_ip(reader)
|
42 |
|
43 |
# Convert to DataFrame for better display
|
44 |
+
df = pd.DataFrame(list(ip_counts.items()), columns=['Annotator', 'Battle Count'])
|
45 |
df = df.sort_values('Battle Count', ascending=False)
|
46 |
|
47 |
# Get current time
|
|
|
53 |
return df, current_time
|
54 |
except Exception as e:
|
55 |
print(f"Error updating stats: {e}")
|
56 |
+
return pd.DataFrame(columns=['Annotator', 'Battle Count']), ""
|
57 |
|
58 |
def auto_update(state):
|
59 |
"""Background task to update stats every hour"""
|