""" Simple web interface for CodeRefactor Gym Space. This provides a basic HTML page to show the environment is running. """ from fastapi import FastAPI from fastapi.responses import HTMLResponse app = FastAPI() @app.get("/", response_class=HTMLResponse) async def root(): """Display environment info page.""" return """ CodeRefactor Gym - OpenEnv Hackathon

🏋️ CodeRefactor Gym

✓ RUNNING

Un environnement OpenEnv qui apprend aux agents RL à refactoriser du code legacy en code moderne et maintenable.

📊 Caractéristiques

🔗 Endpoints API

💻 Exemple d'utilisation

from openenv.client import Client
from models import CodeRefactorGymAction

# Connecter
client = Client(base_url="https://mo35-code-refactor-gym.hf.space")

# Reset
obs = client.reset()
print(f"Legacy code: {obs.legacy_code}")

# Refactoriser
action = CodeRefactorGymAction(
    refactored_code="...",
    reasoning="Added type hints and docstrings"
)
result = client.step(action)
print(f"Reward: {result.reward}")
print(f"Improvement: {result.improvement_score}/100")

📚 Documentation

🏆 OpenEnv Hackathon 2025

Créé par mo35 pour l'OpenEnv Hackathon.
Framework: OpenEnv + TRL (GRPO) + Unsloth
GPU: Northflank H100 80GB

""" @app.get("/health") async def health(): """Health check endpoint.""" return {"status": "healthy"}