Spaces:
Build error

SmartResearcher / deploy.py
atamalik's picture
Upload folder using huggingface_hub
52039c7 verified
Raw History Blame Contribute Delete
1.04 kB
import os
from huggingface_hub import HfApi
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# Get Hugging Face token
HF_TOKEN = os.getenv("HF_TOKEN")
if not HF_TOKEN:
raise ValueError("HF_TOKEN not found in environment variables")
# Initialize Hugging Face Hub client
api = HfApi(token=HF_TOKEN)
# Files to upload
files_to_upload = [
"app.py",
"deep_research.py",
"research_manager.py",
"Search_Evaluator.py",
"planner_agent.py",
"email_agent.py",
"writer_agent.py",
"search_agent.py",
"agents.py",
"requirements.txt",
"README.md"
]
# Upload each file
for file in files_to_upload:
if os.path.exists(file):
print(f"Uploading {file}...")
api.upload_file(
path_or_fileobj=file,
path_in_repo=file,
repo_id="atamalik/SmartResearcher",
repo_type="space"
)
print(f"Successfully uploaded {file}")
else:
print(f"Warning: {file} not found")
print("Deployment completed!")