Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from intent_processor import IntentProcessor
|
| 3 |
+
|
| 4 |
+
def generate_plan(role_text):
|
| 5 |
+
try:
|
| 6 |
+
ip = IntentProcessor(role_text)
|
| 7 |
+
plan, meta = ip.generate_plan(return_metadata=True)
|
| 8 |
+
return f"📜 План: {plan}\n🧠 Метаданные: {meta}"
|
| 9 |
+
except Exception as e:
|
| 10 |
+
return f"❌ Ошибка: {str(e)}"
|
| 11 |
+
|
| 12 |
+
demo = gr.Interface(
|
| 13 |
+
fn=generate_plan,
|
| 14 |
+
inputs=gr.Textbox(lines=4, placeholder="Describe a role...", label="Role Description"),
|
| 15 |
+
outputs="text",
|
| 16 |
+
title="🧠 SAGE Plan Generator",
|
| 17 |
+
description="Semantic extractor of behavioral plan from role prompt."
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
if __name__ == "__main__":
|
| 21 |
+
demo.launch()
|