Spaces:
Running on Zero
Running on Zero
Add Streamable HTTP MCP client and live DeepWiki example
Browse filesFiles changed (3)
- app.py+20
- harnesslab_bundle.zip+2-2
- manifest.json+6-1
62 unmodified lines63646566676818 unmodified lines8788899091929394959662 unmodified linesreport_id = store_report(load_batch(Path(path)), "real_live")return {**result, "workspace_report": f"/?report={report_id}"}@spaces.GPU(duration=10)def gpu_environment_check() -> dict[str, str | float]:"""Optional real CUDA check; never invoked during startup or Mock runs."""18 unmodified linesartifact = gr.File(label="평가 Trace JSON 다운로드")event = execute.click(run_model, inputs=[scenario], outputs=[summary, artifact], api_name="evaluate_model", concurrency_limit=1)event.then(publish_result, inputs=[summary, artifact], outputs=[summary], api_name=False)gr.Markdown("## 선택: GPU 환경 확인\n버튼을 누를 때만 ZeroGPU 쿼터를 사용합니다(요청 최대 10초). Mock 평가와 기록 조회에는 필요하지 않습니다.")diagnostic = gr.Button("GPU 환경 확인 — ZeroGPU 쿼터 사용")gpu_result = gr.JSON(label="환경 확인 결과 — 모델 성능 지표가 아닙니다")diagnostic.click(gpu_environment_check, inputs=[], outputs=[gpu_result], api_name="gpu_environment")application = gr.mount_gradio_app(workspace, info, path="/gradio", ssr_mode=False)# Mounting bypasses Blocks.launch(), which normally sends this registration.try:62 unmodified lines636465666768697071727374757677787980818218 unmodified lines10110210310410510610710810911011111211311411511662 unmodified linesreport_id = store_report(load_batch(Path(path)), "real_live")return {**result, "workspace_report": f"/?report={report_id}"}def test_public_mcp() -> tuple[dict, str]:from harness.mcp_client import MCPClientwith MCPClient("https://mcp.deepwiki.com/mcp") as client:server = client.initialize()tools = client.list_tools()result = client.call_tool("read_wiki_structure", {"repoName": "openai/openai-python"})record = {"server": server, "protocol_version": client.protocol_version,"endpoint": "https://mcp.deepwiki.com/mcp", "tools": [tool.name for tool in tools],"called_tool": "read_wiki_structure", "arguments": {"repoName": "openai/openai-python"},"call": result.model_dump(mode="json")}path = Path(tempfile.gettempdir()) / f"harnesslab-mcp-{uuid4()}.json"path.write_text(json.dumps(record, ensure_ascii=False, indent=2), encoding="utf-8")return record, str(path)@spaces.GPU(duration=10)def gpu_environment_check() -> dict[str, str | float]:"""Optional real CUDA check; never invoked during startup or Mock runs."""18 unmodified linesartifact = gr.File(label="평가 Trace JSON 다운로드")event = execute.click(run_model, inputs=[scenario], outputs=[summary, artifact], api_name="evaluate_model", concurrency_limit=1)event.then(publish_result, inputs=[summary, artifact], outputs=[summary], api_name=False)gr.Markdown("## 외부 MCP 연동 예제 — DeepWiki\nGPU나 API 키 없이 외부 공개 MCP 서버의 도구 목록을 읽고, openai/openai-python 문서 목차를 조회합니다.")mcp_button = gr.Button("DeepWiki MCP 연결 테스트 — GPU 미사용")mcp_result = gr.JSON(label="MCP 실제 호출 결과")mcp_file = gr.File(label="MCP 호출 기록 JSON")mcp_button.click(test_public_mcp, inputs=[], outputs=[mcp_result, mcp_file], api_name="test_deepwiki_mcp", concurrency_limit=1)gr.Markdown("## 선택: GPU 환경 확인\n버튼을 누를 때만 ZeroGPU 쿼터를 사용합니다(요청 최대 10초). Mock 평가와 기록 조회에는 필요하지 않습니다.")diagnostic = gr.Button("GPU 환경 확인 — ZeroGPU 쿼터 사용")gpu_result = gr.JSON(label="환경 확인 결과 — 모델 성능 지표가 아닙니다")diagnostic.click(gpu_environment_check, inputs=[], outputs=[gpu_result], api_name="gpu_environment")info.show_error = Trueapplication = gr.mount_gradio_app(workspace, info, path="/gradio", ssr_mode=False)# Mounting bypasses Blocks.launch(), which normally sends this registration.try:
123version https://git-lfs.github.com/spec/v1oid sha256:cdca6022e818220ad5c9ef7fe0691e3a2e64a10bb42136c86c873df602c452desize 56927123version https://git-lfs.github.com/spec/v1oid sha256:c3be34498172cd817e39263fe2ed184401553dac95e026b1cbbdc50c23049096size 59566
12345630 unmodified lines373839404142{"release": "HarnessLab Gradio Space Prototype","bundle_sha256": "cdca6022e818220ad5c9ef7fe0691e3a2e64a10bb42136c86c873df602c452de","files": [{"path": "harness/__init__.py",30 unmodified lines"bytes": 730,"sha256": "14dd56423f323c5391d55dc70e5d10a070ffa37ae3a26c8080013aff4386a3f7"},{"path": "harness/order_tools.py","bytes": 3171,12345630 unmodified lines3738394041424344454647{"release": "HarnessLab Gradio Space Prototype","bundle_sha256": "c3be34498172cd817e39263fe2ed184401553dac95e026b1cbbdc50c23049096","files": [{"path": "harness/__init__.py",30 unmodified lines"bytes": 730,"sha256": "14dd56423f323c5391d55dc70e5d10a070ffa37ae3a26c8080013aff4386a3f7"},{"path": "harness/mcp_client.py","bytes": 8016,"sha256": "0024aac13d1a646f97937fb5f3500f52d2f707f580d39c4f0b45eb5395d639f4"},{"path": "harness/order_tools.py","bytes": 3171,
app.py+20
harnesslab_bundle.zip+2-2
manifest.json+6-1