mahammadaftab commited on
Commit
2a44712
·
1 Parent(s): 3eb9552

fix: add working HF Space config

Browse files
Files changed (2) hide show
  1. README.md +12 -0
  2. deploy.py +41 -0
README.md CHANGED
@@ -1,3 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  # OpenEnv
2
 
3
  <div align="center">
 
1
+ ---
2
+ title: OpenEnv
3
+ emoji: 🚁
4
+ colorFrom: green
5
+ colorTo: blue
6
+ sdk: gradio
7
+ sdk_version: "<latest>"
8
+ python_version: "3.11"
9
+ app_file: app.py
10
+ pinned: false
11
+ ---
12
+
13
  # OpenEnv
14
 
15
  <div align="center">
deploy.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Deploy OpenEnv to Hugging Face Spaces
3
+ This script uses the Hugging Face Hub API to deploy your space
4
+ """
5
+
6
+ from huggingface_hub import HfApi, login
7
+ import os
8
+
9
+ # Configuration
10
+ HF_TOKEN = "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" # Replace with your actual token
11
+ SPACE_ID = "mahammadaftab/OpenEnv"
12
+
13
+ def deploy_to_spaces():
14
+ """Deploy the local repository to Hugging Face Spaces"""
15
+
16
+ # Login to Hugging Face
17
+ print("Authenticating with Hugging Face...")
18
+ login(token=HF_TOKEN)
19
+
20
+ # Initialize API
21
+ api = HfApi()
22
+
23
+ # Upload the entire repository
24
+ print(f"Uploading to {SPACE_ID}...")
25
+ try:
26
+ api.upload_folder(
27
+ folder_path=".",
28
+ repo_id=SPACE_ID,
29
+ repo_type="space",
30
+ ignore_patterns=["__pycache__", "*.pyc", ".git", "*.md"],
31
+ commit_message="Deploy OpenEnv application"
32
+ )
33
+ print("✅ Deployment successful!")
34
+ except Exception as e:
35
+ print(f"❌ Error during deployment: {e}")
36
+ return False
37
+
38
+ return True
39
+
40
+ if __name__ == "__main__":
41
+ deploy_to_spaces()