Spaces:
Runtime error
Runtime error
Peter Michael Gits
Fix Dockerfile directory permissions - create /app as root before switching users
26096f4 | #!/usr/bin/env python3 | |
| from huggingface_hub import HfApi | |
| import os | |
| # Fix branch issue and deploy to correct branch | |
| api = HfApi() | |
| try: | |
| print("Ensuring files are uploaded to main branch...") | |
| # Upload Gradio files directly to main branch | |
| files_to_upload = [ | |
| ("app_gradio.py", "app.py"), | |
| ("requirements_gradio.txt", "requirements.txt"), | |
| ("README_gradio.md", "README.md") | |
| ] | |
| for local_file, repo_file in files_to_upload: | |
| if os.path.exists(local_file): | |
| print(f"Uploading {local_file} as {repo_file} to main branch...") | |
| api.upload_file( | |
| path_or_fileobj=local_file, | |
| path_in_repo=repo_file, | |
| repo_id="pgits/stt-gpu-service-gradio-test", | |
| repo_type="space", | |
| revision="main", # Explicitly specify main branch | |
| commit_message=f"Upload {repo_file} to main branch for HF Space deployment" | |
| ) | |
| print(f"✓ {repo_file} uploaded to main branch") | |
| else: | |
| print(f"⚠️ {local_file} not found") | |
| print("🚀 Files uploaded to main branch!") | |
| print("HuggingFace Spaces should now detect the app.py file") | |
| print(f"URL: https://huggingface.co/spaces/pgits/stt-gpu-service-gradio-test") | |
| except Exception as e: | |
| print(f"Error: {e}") |