|
|
|
|
|
""" |
|
|
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) |
|
|
|
|
|
|
|
|
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") |
|
|
|
|
|
|
|
|
print("\n🎯 EXACT COMMANDS TO RUN:") |
|
|
print("=" * 30) |
|
|
print("hf auth login") |
|
|
print("hf upload megharudushi/Sheikh .") |
|
|
print("=" * 30) |
|
|
|
|
|
|
|
|
token = os.environ.get('HF_TOKEN') |
|
|
if token: |
|
|
print(f"\n✅ Token found: {token[:8]}...") |
|
|
print("🚀 Running upload...") |
|
|
|
|
|
try: |
|
|
|
|
|
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.") |