File size: 2,499 Bytes
244baf9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
license: mit
base_model:
- stable-diffusion-v1-5/stable-diffusion-v1-5
---

# Dark-Sushi-Mix-v1.5 on LLM8850

原模型地址:https://civitai.com/models/24779?modelVersionId=93208  
当前为 **10 步扩散版本**,固定延迟 20×250 ms ≈ 5 s。

---

## 1. 手动运行(开发调试)

| 步骤 | 命令 |
|------|------|
| 启动后端 | `uvicorn api_10steps:app --host 0.0.0.0 --port 7888` |
| 命令行生图 | `python gen_img.py` |
| Web 界面 | `cd client && python app.py` 后访问 http://127.0.0.1:5000 |

---

## 2. 端侧一键自启(生产部署)

> 开机后自动完成:  
> ① 启动后端 → ② 启动前端 → ③ 自动打开 Firefox 全屏展示 http://localhost:5000/

### 2.1 一键启用

仓库根目录已内置脚本,直接执行:

```bash
# 复制并设置启动脚本
sudo cp sd-launch.sh /opt/sd-launch.sh
sudo chmod +x /opt/sd-launch.sh

# 创建用户级自启动
mkdir -p ~/.config/autostart
cp sd-launch.desktop ~/.config/autostart/

# 确保 Firefox 已安装
sudo apt update && sudo apt install firefox -y
```

### 2.2 文件说明

- `sd-launch.sh`  
  统一启动脚本:切目录 → 后台启动后端 → 后台启动前端 → 等待端口 → 使用 Firefox kiosk 模式自动全屏打开。

- `sd-launch.desktop`  
  用户级自启动配置,在图形界面登录后自动执行脚本。

---

## 3. 日志与维护

| 操作 | 命令 |
|------|------|
| 查看启动日志 | `tail -f /var/log/sd-launch/startup.log` |
| 查看后端日志 | `tail -f /var/log/sd-launch/backend.log` |
| 查看前端日志 | `tail -f /var/log/sd-launch/frontend.log` |
| 查看浏览器日志 | `tail -f /var/log/sd-launch/browser.log` |
| 手动重启 | `pkill -f sd-launch.sh && /opt/sd-launch.sh &` |
| 停止服务 | `pkill -f uvicorn && pkill -f "python3 app.py" && pkill firefox` |

---

## 4. 常见问题

- **Firefox 没有自动打开**  
  确保已安装 Firefox:`sudo apt install firefox -y`
- **重启后服务没启动**  
  检查 `~/.config/autostart/sd-launch.desktop` 是否存在
- **端口冲突**  
  修改脚本中的 `7888` / `5000` 端口即可
- **手动测试浏览器**  
  运行:`firefox --kiosk http://localhost:5000/`

---

## 5. 验证部署

重启系统后,应该看到:
1. 自动启动后端服务(端口 7888)
2. 自动启动前端服务(端口 5000)  
3. Firefox 自动全屏打开 SD 生图界面

至此,AX650 端侧即可实现 **插电即跑** 的 Dark-Sushi-Mix-v1.5 体验。