Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- outputs/logs/episode_rewards.jsonl +0 -0
- server/app.py +22 -35
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
outputs/logs/episode_rewards.jsonl filter=lfs diff=lfs merge=lfs -text
|
outputs/logs/episode_rewards.jsonl
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
server/app.py
CHANGED
|
@@ -29,7 +29,6 @@ Usage:
|
|
| 29 |
"""
|
| 30 |
|
| 31 |
import os
|
| 32 |
-
from pathlib import Path
|
| 33 |
|
| 34 |
try:
|
| 35 |
import openenv.core.env_server.http_server as _openenv_http
|
|
@@ -55,42 +54,30 @@ def _ghostexec_serialize_observation(observation): # type: ignore[no-untyped-de
|
|
| 55 |
_openenv_http.serialize_observation = _ghostexec_serialize_observation
|
| 56 |
|
| 57 |
from openenv.core.env_server.http_server import create_app # noqa: E402
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
|
| 60 |
-
|
| 61 |
-
"""Ensure OpenEnv's web UI can resolve README (Gradio accordion).
|
| 62 |
-
|
| 63 |
-
OpenEnv tries /app/README.md first, then ENV_README_PATH. The Dockerfile
|
| 64 |
-
copies README to /app/README.md; this also sets ENV_README_PATH when a
|
| 65 |
-
preset points at a missing file (common on some hosts) so the loader does
|
| 66 |
-
not skip valid fallbacks.
|
| 67 |
-
"""
|
| 68 |
-
cur = os.environ.get("ENV_README_PATH")
|
| 69 |
-
if cur:
|
| 70 |
-
try:
|
| 71 |
-
p = Path(cur)
|
| 72 |
-
if p.is_file() and p.stat().st_size > 0:
|
| 73 |
-
return
|
| 74 |
-
except OSError:
|
| 75 |
-
pass
|
| 76 |
-
os.environ.pop("ENV_README_PATH", None)
|
| 77 |
-
|
| 78 |
-
_here = Path(__file__).resolve()
|
| 79 |
-
for candidate in (
|
| 80 |
-
Path("/app/env/README.md"),
|
| 81 |
-
Path("/app/README.md"),
|
| 82 |
-
_here.parent.parent / "README.md",
|
| 83 |
-
Path.cwd() / "README.md",
|
| 84 |
-
):
|
| 85 |
-
try:
|
| 86 |
-
if candidate.is_file() and candidate.stat().st_size > 0:
|
| 87 |
-
os.environ["ENV_README_PATH"] = str(candidate)
|
| 88 |
-
return
|
| 89 |
-
except OSError:
|
| 90 |
-
continue
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
_configure_openenv_readme_path()
|
| 94 |
|
| 95 |
try:
|
| 96 |
# Editable / normal install (package name `ghostexec`).
|
|
|
|
| 29 |
"""
|
| 30 |
|
| 31 |
import os
|
|
|
|
| 32 |
|
| 33 |
try:
|
| 34 |
import openenv.core.env_server.http_server as _openenv_http
|
|
|
|
| 54 |
_openenv_http.serialize_observation = _ghostexec_serialize_observation
|
| 55 |
|
| 56 |
from openenv.core.env_server.http_server import create_app # noqa: E402
|
| 57 |
+
import openenv.core.env_server.web_interface as _openenv_web # noqa: E402
|
| 58 |
+
|
| 59 |
+
# Gradio renders readme_content as Markdown; embedding README.md shows YAML frontmatter
|
| 60 |
+
# as plain text. Point users at the Hub-rendered README instead.
|
| 61 |
+
_orig_load_environment_metadata = _openenv_web.load_environment_metadata
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def _ghostexec_load_environment_metadata(env, env_name=None): # type: ignore[no-untyped-def]
|
| 65 |
+
meta = _orig_load_environment_metadata(env, env_name)
|
| 66 |
+
space = (os.environ.get("SPACE_ID") or "").strip()
|
| 67 |
+
if not space or space.startswith("<"):
|
| 68 |
+
space = "modelbuilderhq/ghostexec"
|
| 69 |
+
readme_url = f"https://huggingface.co/spaces/{space}/blob/main/README.md"
|
| 70 |
+
space_url = f"https://huggingface.co/spaces/{space}"
|
| 71 |
+
meta.readme_content = (
|
| 72 |
+
"### README\n\n"
|
| 73 |
+
f"Formatted documentation (Space card + full markdown): "
|
| 74 |
+
f"[**README.md on Hugging Face**]({readme_url})\n\n"
|
| 75 |
+
f"Space: [**{space}**]({space_url})"
|
| 76 |
+
)
|
| 77 |
+
return meta
|
| 78 |
|
| 79 |
|
| 80 |
+
_openenv_web.load_environment_metadata = _ghostexec_load_environment_metadata
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
try:
|
| 83 |
# Editable / normal install (package name `ghostexec`).
|