acepeax's picture
Updated app.py with README.md
c8b90fe unverified
"""
Hugging Face Space - Text Adventure Agent Submission
This is a code-only Space for submitting your agent implementation.
The evaluation is run separately.
Files in this submission:
- agent.py: Your ReAct agent implementation
- mcp_server.py: Your MCP server implementation
- requirements.txt: Additional dependencies
To test locally:
fastmcp dev mcp_server.py
python agent.py
"""
import gradio as gr
from pathlib import Path
def _load_readme() -> str:
readme_path = Path(__file__).with_name("README.md")
if not readme_path.exists():
return "# Text Adventure Agent Submission\n\nREADME.md not found."
text = readme_path.read_text()
if text.startswith("---"):
parts = text.split("\n", 1)
if len(parts) > 1:
rest = parts[1]
end = rest.find("\n---")
if end != -1:
text = rest[end + 4 :].lstrip("\n")
return text
# Create the Gradio interface
with gr.Blocks(title="Text Adventure Agent Submission") as demo:
gr.Markdown(_load_readme())
if __name__ == "__main__":
demo.launch()