Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/barretlee/chatgpt-text-to-midjourney-image
Optimize the prompt using ChatGPT, then send it to Replicate to create an image.
https://github.com/barretlee/chatgpt-text-to-midjourney-image
chatgpt prompt replicate
Last synced: 11 days ago
JSON representation
Optimize the prompt using ChatGPT, then send it to Replicate to create an image.
- Host: GitHub
- URL: https://github.com/barretlee/chatgpt-text-to-midjourney-image
- Owner: barretlee
- License: mit
- Created: 2023-04-03T12:08:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-04T02:25:15.000Z (over 1 year ago)
- Last Synced: 2024-07-31T08:16:12.140Z (3 months ago)
- Topics: chatgpt, prompt, replicate
- Language: JavaScript
- Homepage: https://text2image.awesome-chatgpt.top/
- Size: 105 KB
- Stars: 145
- Watchers: 3
- Forks: 24
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - barretlee/chatgpt-text-to-midjourney-image - Optimize the prompt using ChatGPT, then send it to Replicate to create an image. (JavaScript)
- awesome-ChatGPT-repositories - chatgpt-text-to-midjourney-image - Optimize the prompt using ChatGPT, then send it to Replicate to create an image. (Prompts)
README
# text2image
> [replicate.com](https://replicate.com) 提供了 Model as a Service 的服务,大大降低了普通人玩 Machine Leaning 的门槛,写了一个小工具,将文案送给 ChatGPT 生成可用于图片模型的 Prompt 后,交给 replicate 服务生成图片。—— [Barret李靖](https://twitter.com/Barret_China/status/1642935199347638273)
你可以将本项目直接部署到 Vercel,[点击部署](https://vercel.com/new/clone?s=https://github.com/barretlee/chatgpt-text-to-midjourney-image)
## 启动和调试
安装依赖后,直接执行:
```bash
OPENAI_KEY=${YOUR_KEY} npm run dev
# or
yarn dev
# or
pnpm dev
```然后浏览器打开 [http://localhost:3000](http://localhost:3000)
## 参数设置
由于免费版的 Vercel 执行函数有时长限制,超过 10s 就直接掐断请求了,可以考虑将 `api/text2image` 的内容部署到 [aircode.io](https://aircode.cool/nfyiwynauv) 上,然后在网页添加 proxyUrl:
```bash
http://localhost:3000?proxyUrl=${YOUR_AIRCODE_PROJECT_URI}
```Replicate 上有很多生成好的模型,配置后可以直接运行,在这个工具中,你可以通过配置 url 参数更换 mode:
```bash
http://localhost:3000?m=${MODEL_FROM_REPLICATE}
```我已经在 aircode 上部署了一个副本:,点击 copy 即可完成部署:
## 了解 Replicate
如果你只想了解 [Replicate](https://replicate.com/explore),可以直接执行这份代码:
```javascript
cosnt main = async () => {
const replicate = await import('node-replicate');
# https://replicate.com/prompthero/openjourney
const model = 'prompthero/openjourney:9936c2001faa2194a261c01381f90e65261879985476014a0a37a334593a05eb'
const input = { prompt: "an astronaut riding on a horse" }
await replicate.default.run(model, input);
}
await main();
```## License
[MIT](./LICENSE)