Commit ·
7a36b3c
1
Parent(s): 0eac350
simplified app
Browse files
app.py
CHANGED
|
@@ -17,53 +17,18 @@ To test locally:
|
|
| 17 |
import gradio as gr
|
| 18 |
from pathlib import Path
|
| 19 |
|
| 20 |
-
|
| 21 |
-
def read_readme():
|
| 22 |
-
"""Read the README content."""
|
| 23 |
-
readme_path = Path(__file__).parent / "README.md"
|
| 24 |
-
if readme_path.exists():
|
| 25 |
-
return readme_path.read_text()
|
| 26 |
-
return "# Submission\n\nNo README.md found."
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
def read_file_content(filename: str) -> str:
|
| 30 |
-
"""Read a source file's content."""
|
| 31 |
-
file_path = Path(__file__).parent / filename
|
| 32 |
-
if file_path.exists():
|
| 33 |
-
return file_path.read_text()
|
| 34 |
-
return f"# File not found: {filename}"
|
| 35 |
-
|
| 36 |
-
|
| 37 |
# Create the Gradio interface
|
| 38 |
with gr.Blocks(title="Text Adventure Agent Submission") as demo:
|
| 39 |
gr.Markdown("# Text Adventure Agent Submission")
|
| 40 |
gr.Markdown(
|
| 41 |
-
"This Space contains a
|
| 42 |
-
"Use the tabs below to view the submitted code."
|
| 43 |
)
|
| 44 |
-
|
| 45 |
-
with gr.Tabs():
|
| 46 |
-
with gr.Tab("README"):
|
| 47 |
-
gr.Markdown(read_readme())
|
| 48 |
-
|
| 49 |
-
with gr.Tab("Agent Code"):
|
| 50 |
-
gr.Code(
|
| 51 |
-
value=read_file_content("agent.py"),
|
| 52 |
-
language="python",
|
| 53 |
-
label="agent.py",
|
| 54 |
-
)
|
| 55 |
|
| 56 |
-
with gr.Tab("MCP Server Code"):
|
| 57 |
-
gr.Code(
|
| 58 |
-
value=read_file_content("mcp_server.py"),
|
| 59 |
-
language="python",
|
| 60 |
-
label="mcp_server.py",
|
| 61 |
-
)
|
| 62 |
-
|
| 63 |
gr.Markdown(
|
| 64 |
"---\n"
|
| 65 |
"**Note:** This is a code submission Space. "
|
| 66 |
-
"Evaluation is performed using the evaluation script."
|
|
|
|
| 67 |
)
|
| 68 |
|
| 69 |
|
|
|
|
| 17 |
import gradio as gr
|
| 18 |
from pathlib import Path
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Create the Gradio interface
|
| 21 |
with gr.Blocks(title="Text Adventure Agent Submission") as demo:
|
| 22 |
gr.Markdown("# Text Adventure Agent Submission")
|
| 23 |
gr.Markdown(
|
| 24 |
+
"This Space contains a template submission for the Text Adventure Agent assignment. "
|
|
|
|
| 25 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
gr.Markdown(
|
| 28 |
"---\n"
|
| 29 |
"**Note:** This is a code submission Space. "
|
| 30 |
+
"Evaluation is performed using the evaluation script.\n\n"
|
| 31 |
+
"[Back to main assignment page](https://huggingface.co/spaces/LLM-course/Agentic-zork)"
|
| 32 |
)
|
| 33 |
|
| 34 |
|