Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
-
from src.utils.hf_packager import HFSpacePackager
|
2 |
from src.core.cognitive_engine import CognitiveEngine
|
|
|
3 |
import gradio as gr
|
4 |
import time
|
5 |
import os
|
|
|
6 |
|
7 |
-
#
|
8 |
cognitive_engine = CognitiveEngine()
|
9 |
packager = HFSpacePackager()
|
10 |
|
@@ -27,12 +28,10 @@ def run_cycle(progress=gr.Progress()):
|
|
27 |
return f"⚠️ Critical error: {str(e)}"
|
28 |
|
29 |
def get_resource_usage():
|
30 |
-
# Simplified resource monitoring
|
31 |
-
import psutil
|
32 |
return {
|
33 |
-
"
|
34 |
-
"
|
35 |
-
"
|
36 |
}
|
37 |
|
38 |
with gr.Blocks(css="static/style.css", theme=gr.themes.Soft()) as demo:
|
@@ -42,13 +41,12 @@ with gr.Blocks(css="static/style.css", theme=gr.themes.Soft()) as demo:
|
|
42 |
with gr.Column(scale=1):
|
43 |
start_btn = gr.Button("🚀 Start Improvement Cycle", variant="primary")
|
44 |
status = gr.Textbox(label="Status", interactive=False)
|
45 |
-
hf_token = gr.Textbox(label="HF Token (for private snapshots)", type="password")
|
46 |
|
47 |
gr.Markdown("### System Resources")
|
48 |
resource_display = gr.JSON(label="Current Usage")
|
49 |
|
50 |
demo.load(
|
51 |
-
|
52 |
inputs=[],
|
53 |
outputs=resource_display,
|
54 |
every=5
|
|
|
|
|
1 |
from src.core.cognitive_engine import CognitiveEngine
|
2 |
+
from src.utils.hf_packager import HFSpacePackager
|
3 |
import gradio as gr
|
4 |
import time
|
5 |
import os
|
6 |
+
import psutil
|
7 |
|
8 |
+
# Initialize components
|
9 |
cognitive_engine = CognitiveEngine()
|
10 |
packager = HFSpacePackager()
|
11 |
|
|
|
28 |
return f"⚠️ Critical error: {str(e)}"
|
29 |
|
30 |
def get_resource_usage():
|
|
|
|
|
31 |
return {
|
32 |
+
"cpu": f"{psutil.cpu_percent()}%",
|
33 |
+
"memory": f"{psutil.virtual_memory().percent}%",
|
34 |
+
"disk": f"{psutil.disk_usage('/').percent}%"
|
35 |
}
|
36 |
|
37 |
with gr.Blocks(css="static/style.css", theme=gr.themes.Soft()) as demo:
|
|
|
41 |
with gr.Column(scale=1):
|
42 |
start_btn = gr.Button("🚀 Start Improvement Cycle", variant="primary")
|
43 |
status = gr.Textbox(label="Status", interactive=False)
|
|
|
44 |
|
45 |
gr.Markdown("### System Resources")
|
46 |
resource_display = gr.JSON(label="Current Usage")
|
47 |
|
48 |
demo.load(
|
49 |
+
get_resource_usage,
|
50 |
inputs=[],
|
51 |
outputs=resource_display,
|
52 |
every=5
|