bentosmau commited on
Commit
da678b4
·
1 Parent(s): 3b28ac9

Update script to directly upload files to Hugging Face

Browse files

Modify chat-app/publicar_hf.py to remove Pull Request creation and perform a direct upload of files to the specified Hugging Face repository.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e3ff2484-bbd8-4aba-bea0-1940769b874a
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: d3866803-7fc1-4700-b1a5-7102754168ed
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1739408b-93a5-479b-a658-30f2493b0467/e3ff2484-bbd8-4aba-bea0-1940769b874a/17Q9XjF
Replit-Helium-Checkpoint-Created: true

Files changed (1) hide show
  1. chat-app/publicar_hf.py +21 -34
chat-app/publicar_hf.py CHANGED
@@ -1,45 +1,32 @@
1
  import os
2
- from huggingface_hub import login, upload_folder, create_repo, HfApi
3
 
4
  HF_TOKEN = os.environ.get("HF_TOKEN")
5
 
6
  print("🔐 Iniciando sesión en Hugging Face...")
7
  login(token=HF_TOKEN)
8
 
9
- api = HfApi()
10
-
11
  REPO_ID = "mauriminuano125-a11y/mdfjbots-neo-1"
12
 
13
  print(f"📦 Creando/verificando repositorio: {REPO_ID}")
14
- try:
15
- create_repo(
16
- repo_id=REPO_ID,
17
- repo_type="model",
18
- exist_ok=True,
19
- token=HF_TOKEN,
20
- private=False,
21
- )
22
- print("✅ Repositorio listo.")
23
- except Exception as e:
24
- print(f"⚠️ Aviso: {e}")
 
 
 
 
 
 
25
 
26
- print("⬆️ Subiendo archivos (vía Pull Request)...")
27
- try:
28
- url = upload_folder(
29
- folder_path=".",
30
- repo_id=REPO_ID,
31
- repo_type="model",
32
- token=HF_TOKEN,
33
- ignore_patterns=["*.pyc", "__pycache__", ".env", "publicar_hf.py"],
34
- create_pr=True,
35
- )
36
- print("")
37
- print("✅ ¡Archivos subidos exitosamente como Pull Request!")
38
- print(f"🔗 Revisa tu repositorio: https://huggingface.co/{REPO_ID}")
39
- print(f"🔗 URL del PR: {url}")
40
- except Exception as e:
41
- print(f"❌ Error: {e}")
42
- print("")
43
- print("💡 Asegúrate de que tu token tenga permiso 'write'.")
44
- print(" Ve a: https://huggingface.co/settings/tokens")
45
- print(" Crea un nuevo token con tipo 'Write'")
 
1
  import os
2
+ from huggingface_hub import login, upload_folder, create_repo
3
 
4
  HF_TOKEN = os.environ.get("HF_TOKEN")
5
 
6
  print("🔐 Iniciando sesión en Hugging Face...")
7
  login(token=HF_TOKEN)
8
 
 
 
9
  REPO_ID = "mauriminuano125-a11y/mdfjbots-neo-1"
10
 
11
  print(f"📦 Creando/verificando repositorio: {REPO_ID}")
12
+ create_repo(
13
+ repo_id=REPO_ID,
14
+ repo_type="model",
15
+ exist_ok=True,
16
+ token=HF_TOKEN,
17
+ private=False,
18
+ )
19
+ print("✅ Repositorio listo.")
20
+
21
+ print("⬆️ Subiendo archivos...")
22
+ upload_folder(
23
+ folder_path=".",
24
+ repo_id=REPO_ID,
25
+ repo_type="model",
26
+ token=HF_TOKEN,
27
+ ignore_patterns=["*.pyc", "__pycache__", ".env", "publicar_hf.py"],
28
+ )
29
 
30
+ print("")
31
+ print("✅ ¡Publicado exitosamente en Hugging Face!")
32
+ print(f"🔗 https://huggingface.co/{REPO_ID}")