test / hf_manual_deploy.md
Maynor996's picture
Upload 7 files
75c689e verified

A newer version of the Gradio SDK is available: 6.12.0

Upgrade

Hugging Face 手动部署指南

由于网络连接问题,请按照以下步骤手动部署到 Hugging Face Spaces:

方法 1: 通过 Web 界面上传文件(推荐)

  1. 访问你的 Space

  2. 上传文件

    • 点击页面上的 "Files" 标签
    • 点击 "Upload file" 按钮
    • 上传以下文件(从 /Users/chinamanor/Downloads/cursor编程/gg2/ 目录):
      • app.py
      • gemini.py
      • index.html
      • requirements.txt(使用 requirements-hf.txt 的内容)
      • README.md(使用 README_hf.md 的内容)
      • business_gemini_session.json.example
  3. 文件内容参考

    • requirements.txt 内容:

      flask>=2.0.0
      flask-cors>=3.0.0
      requests>=2.25.0
      urllib3>=1.26.0
      
    • README.md 开头需要添加: ```yaml

      title: Business Gemini Pool emoji: 🚀 colorFrom: blue colorTo: green sdk: gradio sdk_version: 4.44.0 app_file: app.py pinned: false license: mit

      
      

方法 2: 使用 Git 命令(如果网络允许)

# 1. 克隆你的 Space
git clone https://huggingface.co/spaces/Maynor996/gg2
cd gg2

# 2. 复制文件(从项目目录)
cp /Users/chinamanor/Downloads/cursor编程/gg2/app.py ./
cp /Users/chinamanor/Downloads/cursor编程/gg2/gemini.py ./
cp /Users/chinamanor/Downloads/cursor编程/gg2/index.html ./
cp /Users/chinamanor/Downloads/cursor编程/gg2/requirements-hf.txt ./requirements.txt
cp /Users/chinamanor/Downloads/cursor编程/gg2/README_hf.md ./README.md
cp /Users/chinamanor/Downloads/cursor编程/gg2/business_gemini_session.json.example ./

# 3. 提交并推送
git add .
git commit -m "Deploy Business Gemini Pool"
git push

部署后配置

部署成功后:

  1. 访问应用

  2. 配置 Gemini 账号

    • 在 Web 界面点击"账号管理"
    • 添加你的 Gemini 账号信息:
      • Team ID
      • Secure Cookie
      • Host Cookie
      • Session Index
      • User Agent
  3. 测试 API

    curl -X POST https://Maynor996-gg2.hf.space/v1/chat/completions \
      -H "Content-Type: application/json" \
      -d '{
        "model": "gemini-enterprise",
        "messages": [{"role": "user", "content": "Hello!"}]
      }'
    

注意事项

  • Hugging Face 会自动构建和部署你的应用
  • 构建过程通常需要 2-5 分钟
  • 可以在 Space 页面查看构建日志
  • 免费的 CPU Space 有一些限制,但足够基本使用