Spaces:
Running
Running
Junhui Ji
commited on
Commit
·
cbb2661
1
Parent(s):
10e45bb
update readme
Browse files- README.md +53 -1
- service_readme.md +0 -176
README.md
CHANGED
@@ -8,4 +8,56 @@ pinned: false
|
|
8 |
app_port: 7860
|
9 |
---
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
app_port: 7860
|
9 |
---
|
10 |
|
11 |
+
# Boss Translator (解语花)
|
12 |
+
|
13 |
+
An AI-powered design feedback analysis and optimization platform that helps designers understand and respond to client(boss) feedback professionally.
|
14 |
+
|
15 |
+
## Features
|
16 |
+
|
17 |
+
- Design feedback analysis with emotion detection
|
18 |
+
- Professional response suggestions
|
19 |
+
- Design optimization recommendations
|
20 |
+
- Reference case studies
|
21 |
+
- AI generated direct design optimization (by image editing)
|
22 |
+
- Text polishing for professional communication
|
23 |
+
|
24 |
+
## AI Models Used
|
25 |
+
|
26 |
+
- GPT-4.1 series for text analysis and generation
|
27 |
+
- GPT-Image-1 for image editing
|
28 |
+
- DALL-E-2 for creative design generation
|
29 |
+
|
30 |
+
## User Access Levels
|
31 |
+
|
32 |
+
- Free users: Access to all features except image editing
|
33 |
+
- Whitelist users: Limited access to image editing with user key
|
34 |
+
- OpenAI API key holders: Full access to image editing with their own API key
|
35 |
+
- Click link accordingly to add API or user key
|
36 |
+
|
37 |
+
---
|
38 |
+
|
39 |
+
# 解语花 (Boss Translator)
|
40 |
+
|
41 |
+
一个AI驱动的设计反馈分析与优化平台,帮助设计师专业地理解和回应客户(老板)反馈。
|
42 |
+
|
43 |
+
## 功能特点
|
44 |
+
|
45 |
+
- 设计反馈分析及情绪检测
|
46 |
+
- 专业回复建议
|
47 |
+
- 设计优化建议
|
48 |
+
- 参考案例分析
|
49 |
+
- 基于AI生成的设计稿修改图(通过AI图像编辑)
|
50 |
+
- 专业沟通文案润色
|
51 |
+
|
52 |
+
## 使用的AI模型
|
53 |
+
|
54 |
+
- GPT-4.1系列用于文本分析和生成
|
55 |
+
- GPT-Image-1用于图像编辑
|
56 |
+
- DALL-E-2用于创意设计生成
|
57 |
+
|
58 |
+
## 用户权限
|
59 |
+
|
60 |
+
- 普通用户:除图片编辑外的所有功能免费使用
|
61 |
+
- 白名单用户:提供密钥后可有限使用图像编辑功能
|
62 |
+
- OpenAI API密钥持有者:可使用自己的API密钥进行图像编辑
|
63 |
+
- 点击相应文本提供sk和密钥
|
service_readme.md
DELETED
@@ -1,176 +0,0 @@
|
|
1 |
-
# 网站截图服务
|
2 |
-
|
3 |
-
这是一个使用 FastAPI 和 Playwright 构建的简单网站截图服务,可以生成任何网页的高质量截图。
|
4 |
-
|
5 |
-
## 功能特点
|
6 |
-
|
7 |
-
- 支持任何公开可访问的网页截图
|
8 |
-
- 可自定义截图尺寸
|
9 |
-
- 支持 PNG 格式输出
|
10 |
-
- 自动缓存生成的截图
|
11 |
-
- 提供 REST API 接口
|
12 |
-
- 异步处理,高性能
|
13 |
-
|
14 |
-
## 系统要求
|
15 |
-
|
16 |
-
- Python 3.9 或更高版本
|
17 |
-
- pip 包管理器
|
18 |
-
|
19 |
-
## 安装步骤
|
20 |
-
|
21 |
-
1. 克隆或下载本项目
|
22 |
-
|
23 |
-
2. 安装依赖
|
24 |
-
```bash
|
25 |
-
pip install -r requirements.txt
|
26 |
-
playwright install chromium
|
27 |
-
```
|
28 |
-
|
29 |
-
3. 启动服务
|
30 |
-
```bash
|
31 |
-
python screenshot_service.py
|
32 |
-
```
|
33 |
-
|
34 |
-
服务将在 `http://localhost:7860` 启动。
|
35 |
-
|
36 |
-
## API 使用说明
|
37 |
-
|
38 |
-
### 生成网页截图
|
39 |
-
|
40 |
-
**请求**:
|
41 |
-
|
42 |
-
```
|
43 |
-
POST /capture
|
44 |
-
Content-Type: application/json
|
45 |
-
```
|
46 |
-
|
47 |
-
**请求体**:
|
48 |
-
|
49 |
-
```json
|
50 |
-
{
|
51 |
-
"url": "https://example.com",
|
52 |
-
"width": 1024,
|
53 |
-
"height": 768,
|
54 |
-
"format": "png",
|
55 |
-
"custom_headers": {
|
56 |
-
"User-Agent": "Custom User Agent"
|
57 |
-
}
|
58 |
-
}
|
59 |
-
```
|
60 |
-
|
61 |
-
参数说明:
|
62 |
-
- `url`: 必填,要截图的网页地址
|
63 |
-
- `width`: 可选,截图宽度,默认 1024
|
64 |
-
- `height`: 可选,截图高度,默认 768
|
65 |
-
- `format`: 可选,图片格式,目前支持 png,默认为 png
|
66 |
-
- `custom_headers`: 可选,自定义请求头
|
67 |
-
|
68 |
-
**成功响应**:
|
69 |
-
|
70 |
-
```json
|
71 |
-
{
|
72 |
-
"success": true,
|
73 |
-
"imageUrl": "http://localhost:7860/screenshots/example_com_1633456789.png",
|
74 |
-
"filename": "example_com_1633456789.png"
|
75 |
-
}
|
76 |
-
```
|
77 |
-
|
78 |
-
**错误响应**:
|
79 |
-
|
80 |
-
```json
|
81 |
-
{
|
82 |
-
"detail": "截图生成失败: 导航超时,网页加载时间过长"
|
83 |
-
}
|
84 |
-
```
|
85 |
-
|
86 |
-
### 检查服务健康状态
|
87 |
-
|
88 |
-
**请求**:
|
89 |
-
|
90 |
-
```
|
91 |
-
GET /health
|
92 |
-
```
|
93 |
-
|
94 |
-
**响应**:
|
95 |
-
|
96 |
-
```json
|
97 |
-
{
|
98 |
-
"status": "ok"
|
99 |
-
}
|
100 |
-
```
|
101 |
-
|
102 |
-
## 在你的应用中使用
|
103 |
-
|
104 |
-
在客户端 JavaScript 中调用服务:
|
105 |
-
|
106 |
-
```javascript
|
107 |
-
async function getScreenshot(url) {
|
108 |
-
try {
|
109 |
-
const response = await fetch('http://localhost:7860/capture', {
|
110 |
-
method: 'POST',
|
111 |
-
headers: {
|
112 |
-
'Content-Type': 'application/json'
|
113 |
-
},
|
114 |
-
body: JSON.stringify({
|
115 |
-
url: url,
|
116 |
-
width: 1024,
|
117 |
-
height: 768
|
118 |
-
})
|
119 |
-
});
|
120 |
-
|
121 |
-
const data = await response.json();
|
122 |
-
return data.imageUrl;
|
123 |
-
} catch (error) {
|
124 |
-
console.error('截图服务请求失败:', error);
|
125 |
-
return null;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
```
|
129 |
-
|
130 |
-
在 Python 中调用服务:
|
131 |
-
|
132 |
-
```python
|
133 |
-
import requests
|
134 |
-
|
135 |
-
def get_screenshot(url):
|
136 |
-
try:
|
137 |
-
response = requests.post(
|
138 |
-
'http://localhost:7860/capture',
|
139 |
-
json={
|
140 |
-
'url': url,
|
141 |
-
'width': 1024,
|
142 |
-
'height': 768
|
143 |
-
}
|
144 |
-
)
|
145 |
-
data = response.json()
|
146 |
-
return data['imageUrl']
|
147 |
-
except Exception as e:
|
148 |
-
print(f'截图服务请求失败: {str(e)}')
|
149 |
-
return None
|
150 |
-
```
|
151 |
-
|
152 |
-
## 部署建议
|
153 |
-
|
154 |
-
在生产环境部署时,建议:
|
155 |
-
|
156 |
-
1. 使用 Docker 容器化部署
|
157 |
-
2. 使用 Gunicorn 或 Uvicorn 作为生产级 ASGI 服务器
|
158 |
-
3. 设置合适的超时时间和内存限制
|
159 |
-
4. 配置 HTTPS 以保证安全性
|
160 |
-
5. 添加访问限制或身份验证
|
161 |
-
|
162 |
-
## Docker 部署
|
163 |
-
|
164 |
-
1. 构建镜像
|
165 |
-
```bash
|
166 |
-
docker build -t screenshot-service .
|
167 |
-
```
|
168 |
-
|
169 |
-
2. 运行容器
|
170 |
-
```bash
|
171 |
-
docker run -p 7860:7860 screenshot-service
|
172 |
-
```
|
173 |
-
|
174 |
-
## 许可证
|
175 |
-
|
176 |
-
MIT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|