Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from codex.reflex_loop import run_reflex_engine
|
| 4 |
+
from codex.memory_logger import log_interaction
|
| 5 |
+
|
| 6 |
+
def handle_input(user_input):
|
| 7 |
+
response = run_reflex_engine(user_input)
|
| 8 |
+
log = log_interaction(user_input, response)
|
| 9 |
+
return response, log
|
| 10 |
+
|
| 11 |
+
with gr.Blocks() as demo:
|
| 12 |
+
gr.Markdown(open("ui/interface.md").read())
|
| 13 |
+
with gr.Row():
|
| 14 |
+
with gr.Column():
|
| 15 |
+
input_box = gr.Textbox(label="💡 Enter Intent")
|
| 16 |
+
submit = gr.Button("🚀 Run")
|
| 17 |
+
with gr.Column():
|
| 18 |
+
output_box = gr.Textbox(label="🧠 Response")
|
| 19 |
+
log_box = gr.Textbox(label="📜 Log")
|
| 20 |
+
submit.click(fn=handle_input, inputs=input_box, outputs=[output_box, log_box])
|
| 21 |
+
|
| 22 |
+
demo.launch()
|