Spaces:
Runtime error
Runtime error
Upload 6 files
Browse files- README.md +1 -10
- app.py +42 -8
- requirements.txt +1 -2
README.md
CHANGED
@@ -1,13 +1,4 @@
|
|
1 |
-
|
2 |
-
title: Autonomous AI
|
3 |
-
emoji: π€
|
4 |
-
colorFrom: gray
|
5 |
-
colorTo: green
|
6 |
-
sdk: gradio
|
7 |
-
sdk_version: "3.41.0"
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
# π€ Autonomous AI β Fully Self-Updating Python Agent
|
12 |
|
13 |
This is a powerful, self-improving autonomous agent capable of:
|
|
|
1 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
# π€ Autonomous AI β Fully Self-Updating Python Agent
|
3 |
|
4 |
This is a powerful, self-improving autonomous agent capable of:
|
app.py
CHANGED
@@ -1,17 +1,51 @@
|
|
1 |
|
2 |
import gradio as gr
|
3 |
from agent import autonomous_agent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
with gr.Blocks() as demo:
|
6 |
-
gr.Markdown("# π€ Autonomous AI
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
return [(message, result)]
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
16 |
|
17 |
demo.launch()
|
|
|
1 |
|
2 |
import gradio as gr
|
3 |
from agent import autonomous_agent
|
4 |
+
from utils import read_memory
|
5 |
+
|
6 |
+
def run_task(task):
|
7 |
+
result = autonomous_agent(task)
|
8 |
+
return result, read_memory()
|
9 |
+
|
10 |
+
def update_memory(new_text):
|
11 |
+
with open("memory.txt", "w") as f:
|
12 |
+
f.write(new_text)
|
13 |
+
return "β
Memory updated."
|
14 |
+
|
15 |
+
def view_logs():
|
16 |
+
import os, json
|
17 |
+
log_entries = []
|
18 |
+
if not os.path.exists("logs"):
|
19 |
+
return "No logs yet."
|
20 |
+
for filename in sorted(os.listdir("logs"))[-5:]: # Last 5 logs
|
21 |
+
with open(f"logs/{filename}", "r") as f:
|
22 |
+
data = json.load(f)
|
23 |
+
log_entries.append(f"π {data['timestamp']}\nπ§ Task: {data['task']}\nβ
Result: {data['result'][:100]}...\n---")
|
24 |
+
return "\n\n".join(log_entries) if log_entries else "No logs found."
|
25 |
|
26 |
with gr.Blocks() as demo:
|
27 |
+
gr.Markdown("# π€ Autonomous AI Agent")
|
28 |
+
|
29 |
+
with gr.Tab("π¬ Task Runner"):
|
30 |
+
chatbot = gr.Textbox(lines=2, label="What should the AI do?")
|
31 |
+
submit = gr.Button("Execute")
|
32 |
+
output = gr.Textbox(label="Result")
|
33 |
+
memory_out = gr.Textbox(label="Memory Snapshot", lines=6)
|
34 |
+
|
35 |
+
submit.click(run_task, inputs=chatbot, outputs=[output, memory_out])
|
36 |
+
|
37 |
+
with gr.Tab("π§ Memory Editor"):
|
38 |
+
mem_editor = gr.Textbox(label="Edit memory.txt", lines=10)
|
39 |
+
save_mem = gr.Button("Save Changes")
|
40 |
+
result = gr.Textbox(label="Status")
|
41 |
|
42 |
+
save_mem.click(update_memory, inputs=mem_editor, outputs=result)
|
43 |
+
demo.load(read_memory, inputs=[], outputs=mem_editor)
|
|
|
44 |
|
45 |
+
with gr.Tab("π Recent Logs"):
|
46 |
+
log_output = gr.Textbox(label="Last 5 Logs", lines=20)
|
47 |
+
refresh_logs = gr.Button("Refresh")
|
48 |
+
refresh_logs.click(view_logs, outputs=log_output)
|
49 |
+
demo.load(view_logs, outputs=log_output)
|
50 |
|
51 |
demo.launch()
|
requirements.txt
CHANGED
@@ -1,2 +1 @@
|
|
1 |
-
gradio
|
2 |
-
|
|
|
1 |
+
gradio
|
|