Tpayne101 commited on
Commit
de0b566
·
verified ·
1 Parent(s): 2911d99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -0
app.py CHANGED
@@ -56,4 +56,63 @@ dna_viewer = gr.Interface(
56
 
57
  # Combine both UIs into tabs
58
  app = gr.TabbedInterface([iface, dna_viewer], ["AgentOS Core", "Digital DNA Viewer"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  app.launch()
 
56
 
57
  # Combine both UIs into tabs
58
  app = gr.TabbedInterface([iface, dna_viewer], ["AgentOS Core", "Digital DNA Viewer"])
59
+ app.launch()
60
+ import gradio as gr
61
+ from agentos_core import AgentCore
62
+ from context_graph import ContextGraph
63
+ import json, os
64
+
65
+ # --- Instantiate Core Systems ---
66
+ agent = AgentCore()
67
+ graph = ContextGraph()
68
+
69
+ # --- Define main agent function ---
70
+ def interact(prompt):
71
+ response = agent.run(prompt)
72
+ return response
73
+
74
+ iface = gr.Interface(
75
+ fn=interact,
76
+ inputs="text",
77
+ outputs="text",
78
+ title="🧠 AgentOS MVP",
79
+ description="Self-learning agent with memory + telemetry."
80
+ )
81
+
82
+ # --- Context Query Tab ---
83
+ def query_context_ui(agent_id, keyword):
84
+ return "\n".join(graph.query_context(agent_id, keyword))
85
+
86
+ context_view = gr.Interface(
87
+ fn=query_context_ui,
88
+ inputs=[
89
+ gr.Textbox(label="Agent ID"),
90
+ gr.Textbox(label="Keyword")
91
+ ],
92
+ outputs="text",
93
+ title="🕸 Context Memory Query",
94
+ description="Search what the agent already knows or has linked in memory."
95
+ )
96
+
97
+ # --- Digital DNA Viewer Tab ---
98
+ def show_identities():
99
+ if os.path.exists("agent_identities.json"):
100
+ with open("agent_identities.json", "r") as f:
101
+ return json.dumps(json.load(f), indent=2)
102
+ return "No digital DNA file found yet."
103
+
104
+ dna_viewer = gr.Interface(
105
+ fn=show_identities,
106
+ inputs=[],
107
+ outputs="text",
108
+ title="🔐 Digital DNA Viewer",
109
+ description="View all agent identities and their signatures."
110
+ )
111
+
112
+ # --- Combine all interfaces ---
113
+ app = gr.TabbedInterface(
114
+ [iface, dna_viewer, context_view],
115
+ ["AgentOS Core", "Digital DNA Viewer", "Context Query"]
116
+ )
117
+
118
  app.launch()