File size: 2,902 Bytes
7d3d63c |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
#!/usr/bin/env python3
"""
Execute the exact commands from user:
hf auth login
hf upload megharudushi/Sheikh .
"""
import os
import subprocess
def execute_user_commands():
"""Execute the exact commands the user provided"""
print("🚀 Executing Your Hugging Face Upload Commands")
print("=" * 50)
print("Commands to run:")
print("1. hf auth login")
print("2. hf upload megharudushi/Sheikh .")
print("=" * 50)
# Check model files
if not os.path.exists("ready_bengali_ai"):
print("❌ Error: ready_bengali_ai directory not found!")
return False
files = os.listdir("ready_bengali_ai")
print(f"📁 Ready to upload: {len(files)} files")
# Show the exact command to run
print("\n🎯 EXACT COMMANDS TO RUN:")
print("=" * 30)
print("hf auth login")
print("hf upload megharudushi/Sheikh .")
print("=" * 30)
# Check for token environment variable
token = os.environ.get('HF_TOKEN')
if token:
print(f"\n✅ Token found: {token[:8]}...")
print("🚀 Running upload...")
try:
# Run upload with token
env = os.environ.copy()
result = subprocess.run(
["hf", "upload", "megharudushi/Sheikh", "."],
env=env,
capture_output=True,
text=True
)
if result.returncode == 0:
print("\n🎉 SUCCESS! Model uploaded!")
print("🌐 https://huggingface.co/megharudushi/Sheikh")
return True
else:
print(f"❌ Upload failed: {result.stderr}")
return False
except Exception as e:
print(f"❌ Error: {e}")
return False
else:
print("\n❌ No HF_TOKEN environment variable found")
print("\n🔧 TO COMPLETE UPLOAD:")
print("1. Get your token: https://huggingface.co/settings/tokens")
print("2. Set environment variable:")
print(" export HF_TOKEN=your_token_here")
print("3. Run the commands:")
print(" hf auth login")
print(" hf upload megharudushi/Sheikh .")
return False
if __name__ == "__main__":
print("🇧🇩 EXECUTING YOUR HUGGING FACE COMMANDS")
print("Repository: megharudushi/Sheikh")
success = execute_user_commands()
if success:
print("\n🎊 YOUR BANGLI AI IS NOW LIVE!")
print("Anyone can use it with:")
print("from transformers import AutoTokenizer, AutoModelForCausalLM")
print('tokenizer = AutoTokenizer.from_pretrained("megharudushi/Sheikh")')
print('model = AutoModelForCausalLM.from_pretrained("megharudushi/Sheikh")')
else:
print("\n📋 SETUP REQUIRED:")
print("Get your HF token and run the commands above.") |