Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ class ModelManager:
|
|
| 53 |
|
| 54 |
model_manager = ModelManager()
|
| 55 |
|
| 56 |
-
def get_system_stats():
|
| 57 |
"""Returns a dictionary of current system metrics with formatted strings."""
|
| 58 |
mem = psutil.virtual_memory()
|
| 59 |
disk = psutil.disk_usage('/')
|
|
@@ -61,7 +61,7 @@ def get_system_stats():
|
|
| 61 |
f"CPU\t\t: {psutil.cpu_percent(interval=1)}%\n"
|
| 62 |
f"Mem\t\t: {round(mem.used / (1024**3), 2)} / {round(mem.total / (1024**3), 2)} GB\n"
|
| 63 |
f"Disk\t\t: {round(disk.used / (1024**3), 2)} / {round(disk.total / (1024**3), 2)} GB\n"
|
| 64 |
-
f"Active\t\t: {len(ACTIVE_SESSIONS)}/5min"
|
| 65 |
)
|
| 66 |
|
| 67 |
def load_new_model(model_id):
|
|
@@ -208,7 +208,6 @@ with gr.Blocks(title="Small MF Model Tester", theme=gr.themes.Soft()) as app:
|
|
| 208 |
)
|
| 209 |
|
| 210 |
clean_btn.click(fn=clean_cache, outputs=[status_output])
|
| 211 |
-
app.load(fn=live_count, inputs=[], outputs=[], every=10)
|
| 212 |
|
| 213 |
if __name__ == "__main__":
|
| 214 |
app.launch()
|
|
|
|
| 53 |
|
| 54 |
model_manager = ModelManager()
|
| 55 |
|
| 56 |
+
def get_system_stats(request: gr.Request = None):
|
| 57 |
"""Returns a dictionary of current system metrics with formatted strings."""
|
| 58 |
mem = psutil.virtual_memory()
|
| 59 |
disk = psutil.disk_usage('/')
|
|
|
|
| 61 |
f"CPU\t\t: {psutil.cpu_percent(interval=1)}%\n"
|
| 62 |
f"Mem\t\t: {round(mem.used / (1024**3), 2)} / {round(mem.total / (1024**3), 2)} GB\n"
|
| 63 |
f"Disk\t\t: {round(disk.used / (1024**3), 2)} / {round(disk.total / (1024**3), 2)} GB\n"
|
| 64 |
+
f"Active\t\t: {len(ACTIVE_SESSIONS) if request is None else live_count(request)}/5min"
|
| 65 |
)
|
| 66 |
|
| 67 |
def load_new_model(model_id):
|
|
|
|
| 208 |
)
|
| 209 |
|
| 210 |
clean_btn.click(fn=clean_cache, outputs=[status_output])
|
|
|
|
| 211 |
|
| 212 |
if __name__ == "__main__":
|
| 213 |
app.launch()
|