Spaces:
Paused
Paused
| import streamlit as st | |
| import subprocess | |
| from pathlib import Path | |
| import json | |
| st.set_page_config(page_title="PygmyClaw", layout="wide") | |
| st.title("🦾 PygmyClaw Autonomous Agent") | |
| # Workspace | |
| workspace = Path("/workspace/data") | |
| workspace.mkdir(exist_ok=True) | |
| # User input | |
| prompt = st.text_area("Enter your prompt:", height=100) | |
| if st.button("Submit Prompt"): | |
| st.info("Processing...") | |
| # Call pygmyclaw agent | |
| result = subprocess.run( | |
| ["python3", "pygmyclaw.py", "generate", prompt], | |
| capture_output=True, text=True | |
| ) | |
| st.success("Done!") | |
| st.code(result.stdout, language="text") | |
| # Optional: code editor + run | |
| code_files = list(workspace.glob("*.py")) | |
| if code_files: | |
| st.subheader("Generated Python Scripts") | |
| for f in code_files: | |
| code = f.read_text() | |
| edited_code = st.text_area(f.name, code, height=200) | |
| if st.button(f"Run {f.name}"): | |
| exec_result = subprocess.run( | |
| ["python3", "-c", edited_code], | |
| capture_output=True, text=True | |
| ) | |
| st.code(exec_result.stdout + "\n" + exec_result.stderr) |