bentosmau commited on
Commit ·
44667fe
1
Parent(s): 8d24498
Publish chatbot to Hugging Face Spaces and adjust app configuration
Browse filesUpdate `app.py` to correctly set `root_path` for Hugging Face Spaces and modify `publicar_hf.py` to deploy as a Gradio Space instead of a model repository.
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: e3ff2484-bbd8-4aba-bea0-1940769b874a
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: a0f6e664-f316-403b-9fe7-01d987c0df5d
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1739408b-93a5-479b-a658-30f2493b0467/e3ff2484-bbd8-4aba-bea0-1940769b874a/AosEVI5
Replit-Helium-Checkpoint-Created: true
- chat-app/app.py +1 -1
- chat-app/publicar_hf.py +15 -9
chat-app/app.py
CHANGED
|
@@ -203,7 +203,7 @@ with gr.Blocks(title="mdfjbots-neo-1") as demo:
|
|
| 203 |
if __name__ == "__main__":
|
| 204 |
port = int(os.environ.get("PORT", 5000))
|
| 205 |
dev_domain = os.environ.get("REPLIT_DEV_DOMAIN", "")
|
| 206 |
-
root_path = f"https://{dev_domain}/__neo1" if dev_domain else "
|
| 207 |
demo.launch(
|
| 208 |
server_name="0.0.0.0",
|
| 209 |
server_port=port,
|
|
|
|
| 203 |
if __name__ == "__main__":
|
| 204 |
port = int(os.environ.get("PORT", 5000))
|
| 205 |
dev_domain = os.environ.get("REPLIT_DEV_DOMAIN", "")
|
| 206 |
+
root_path = f"https://{dev_domain}/__neo1" if dev_domain else ""
|
| 207 |
demo.launch(
|
| 208 |
server_name="0.0.0.0",
|
| 209 |
server_port=port,
|
chat-app/publicar_hf.py
CHANGED
|
@@ -2,31 +2,37 @@ 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 |
-
|
| 10 |
-
|
| 11 |
-
print(f"📦 Creando/verificando repositorio: {REPO_ID}")
|
| 12 |
create_repo(
|
| 13 |
repo_id=REPO_ID,
|
| 14 |
-
repo_type="
|
|
|
|
| 15 |
exist_ok=True,
|
| 16 |
token=HF_TOKEN,
|
| 17 |
private=False,
|
| 18 |
)
|
| 19 |
-
print("✅
|
| 20 |
|
| 21 |
print("⬆️ Subiendo archivos...")
|
| 22 |
upload_folder(
|
| 23 |
folder_path=".",
|
| 24 |
repo_id=REPO_ID,
|
| 25 |
-
repo_type="
|
| 26 |
token=HF_TOKEN,
|
| 27 |
-
ignore_patterns=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
)
|
| 29 |
|
| 30 |
print("")
|
| 31 |
-
print("✅ ¡Publicado exitosamente en Hugging Face!")
|
| 32 |
-
print(f"🔗 https://huggingface.co/{REPO_ID}")
|
|
|
|
| 2 |
from huggingface_hub import login, upload_folder, create_repo
|
| 3 |
|
| 4 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 5 |
+
REPO_ID = "mauriminuano125-a11y/mdfjbots-neo-1"
|
| 6 |
|
| 7 |
print("🔐 Iniciando sesión en Hugging Face...")
|
| 8 |
login(token=HF_TOKEN)
|
| 9 |
|
| 10 |
+
print(f"📦 Creando/verificando Space: {REPO_ID}")
|
|
|
|
|
|
|
| 11 |
create_repo(
|
| 12 |
repo_id=REPO_ID,
|
| 13 |
+
repo_type="space",
|
| 14 |
+
space_sdk="gradio",
|
| 15 |
exist_ok=True,
|
| 16 |
token=HF_TOKEN,
|
| 17 |
private=False,
|
| 18 |
)
|
| 19 |
+
print("✅ Space listo.")
|
| 20 |
|
| 21 |
print("⬆️ Subiendo archivos...")
|
| 22 |
upload_folder(
|
| 23 |
folder_path=".",
|
| 24 |
repo_id=REPO_ID,
|
| 25 |
+
repo_type="space",
|
| 26 |
token=HF_TOKEN,
|
| 27 |
+
ignore_patterns=[
|
| 28 |
+
"*.pyc",
|
| 29 |
+
"__pycache__",
|
| 30 |
+
".env",
|
| 31 |
+
"publicar_hf.py",
|
| 32 |
+
"*.log",
|
| 33 |
+
],
|
| 34 |
)
|
| 35 |
|
| 36 |
print("")
|
| 37 |
+
print("✅ ¡Publicado exitosamente en Hugging Face Spaces!")
|
| 38 |
+
print(f"🔗 https://huggingface.co/spaces/{REPO_ID}")
|