🎲 用中文提示词生成 3D 世界
- 📝 中文输入 - 直接用中文描述你的想象
- 🖼️ 图片转 3D - 支持上传图片生成
- 🎮 交互式预览 - 生成后可交互查看 3D 世界
- 💡 示例画廊 - 快速参考示例
- 🤖 本地 LLM 支持 - 可选使用 LM Studio 或 Ollama 优化提示词
用户(中文)
↓
后端 Flask API
↓
[可选] 翻译 → World Labs API
↓
返回 3D 世界 URL
git clone https://github.com/yourusername/marble-3d-service.git
cd marble-3d-servicecd backend
pip install -r requirements.txt# 创建 .env 文件
cp .env.example .env编辑 .env 文件,设置 World Labs API Key:
WORLD_LABS_API_KEY=your_api_key_here
SECRET_KEY=your_secret_key
⚠️ 重要: 请前往 World Labs AI 获取 API Key
python app.py后端将在 http://localhost:5000 运行
将 frontend/index.html 部署到任何静态托管服务(Vercel、Netlify、Nginx 等)
将前端文件复制到 Flask 的 static 目录:
mkdir -p backend/static
cp frontend/index.html backend/static/POST /api/create
参数:
prompt(string): 提示词image(file, optional): 图片文件
响应:
{
"success": true,
"task_id": "xxx",
"status": "completed",
"result": {
"world_url": "https://marble.worldlabs.ai/world/xxx",
"preview_url": "https://xxx.jpg"
}
}GET /api/task/<task_id>
参数:
api_key(query, optional): 自定义 API Key
响应:
{
"success": true,
"status": "completed",
"result": {
"world_id": "xxx",
"world_url": "https://marble.worldlabs.ai/world/xxx",
"preview_url": "https://xxx.jpg",
"pano_url": "https://xxx.jpg",
"thumbnail_url": "https://xxx.jpg",
"caption": "世界描述",
"spz_100k": "https://...",
"spz_500k": "https://...",
"spz_full": "https://...",
"mesh_url": "https://..."
}
}GET /api/llm-status
响应:
{
"success": true,
"available": true,
"type": "lmstudio",
"url": "http://localhost:1234"
}pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:appFROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "app:app"]| 变量名 | 必填 | 说明 |
|---|---|---|
WORLD_LABS_API_KEY |
✅ | World Labs API 密钥 |
SECRET_KEY |
❌ | Flask 密钥(生产环境必填) |
PORT |
❌ | 服务器端口(默认 5000) |
服务支持使用本地 LLM(LM Studio 或 Ollama)优化中文提示词:
- LM Studio: 启动 Local Server(默认端口 1234)
- Ollama: 运行
ollama serve(默认端口 11434)
服务会自动检测并使用的本地 LLM,将中文提示词优化为更详细的英文描述。
MIT License
- World Labs AI - 3D 世界生成 API
- Flask - Web 框架
- LM Studio - 本地 LLM 运行环境
- Ollama - 本地 LLM 运行环境