Spaces:
Running
Running
File size: 635 Bytes
adff592 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import os
readme_path = 'rl_code_fix_env/README.md'
with open(readme_path, 'r', encoding='utf-8') as f:
text = f.read()
# Strip any existing YAML header if present, then add the clean one
parts = text.split('---')
if len(parts) >= 3:
body = '---'.join(parts[2:])
else:
body = text
header = """---
title: Rl Code Fix Env
emoji: 🚀
colorFrom: green
colorTo: purple
sdk: docker
dockerfile: server/Dockerfile
app_port: 8000
pinned: false
---
"""
new_content = header + body.strip() + "\n"
# Write with Unix line endings
with open(readme_path, 'wb') as f:
f.write(new_content.encode('utf-8').replace(b'\r\n', b'\n'))
|