Spaces:
Running
Running
| import os | |
| import sys | |
| import subprocess | |
| # Force UTF-8 output for Windows terminals | |
| sys.stdout.reconfigure(encoding='utf-8') | |
| readme_content = """--- | |
| title: MerchFlow AI | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: indigo | |
| sdk: docker | |
| pinned: false | |
| --- | |
| # MerchFlow AI | |
| An AI-powered merchandising agent. | |
| """ | |
| def run_command(command): | |
| print(f"Running: {command}") | |
| try: | |
| subprocess.run(command, check=True, shell=True) | |
| print("β Success") | |
| except subprocess.CalledProcessError as e: | |
| print(f"β Error: {e}") | |
| # Don't exit, try to continue or let user see error | |
| def fix_readme(): | |
| print("Writing README.md...") | |
| with open("README.md", "w", encoding="utf-8") as f: | |
| f.write(readme_content) | |
| print("β Created README.md") | |
| print("Deploying changes...") | |
| run_command("git add README.md") | |
| run_command('git commit -m "Add Hugging Face configuration"') | |
| run_command("git push space clean_deploy:main") | |
| print("β Configuration fixed and pushed!") | |
| if __name__ == "__main__": | |
| fix_readme() | |