借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

只需要将ollama部署到本地,借助comfyui ollama节点即可给你的Ai绘画提示词插上想象的翅膀。具体看详细步骤!

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

第一步打开ollama官网:https://ollama.com/,并选择models显存太小选择的是llama3\8b参数的instruct-q6_k的这个模型。

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

运行方式也很简单,只要你网络没问题,直接在终端里,运行ollama run llama3:8b-instruct-q6_K这个命令,这样你可以在终端里llama3交流了!

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

当然咱们说的是在comfyui里运用llama3模型实现提示词自由的,所以我们需要安装comfy ollama节点,如图所示直接install即可

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

然后开始搭建ollama提示词节点,节点的提示词部分包含三个部分

第一部分汉译英过程:

命令提示词为:Translate the following into English, do not add any text other than the prompt:

其中节点:cr text concatenate是帮助字符串链接的一个节点!其中上面的是指令规则,下面的是要执行的具体指令。

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!
You are a prompt engineer proficient in SDXL painting, especially skilled in refining prompts. Please strictly follow the steps below to refine the prompts that need to be refined, operate step by step and output the results of each step:

Step 1: List the names and genders of all the characters in the prompt. If there are no characters in the prompt, skip this step.

Step 2: Use a short phrase to describe all the characters in the prompt. This phrase can use plurals or and, do not use any punctuation. Do not use any punctuation in this short phrase. Do not use any punctuation in this short phrase. The format is as follows:
- 1boy
- 1girl
- 2boys
- 2girls
- 1girl and 1boy

Step 3: Identify the main subjects in the prompt word. If you can guess which work it/them comes from, list the name of the work in the format:
- Link from The Legend of Zelda series, Spider-Man from Marvel movies, ...
If there is no prominent subject in the prompt, such as if the prompt is purely a landscape, skip this step.

Step 4: Combine the contents of the previous two steps, separated by commas. If there is no prominent subject in the prompt, such as if the prompt is pure scenery, skip this step and do not output any characters.

Step 5: 
If the prompt contains a character, use the result from the previous step as the beginning, and creatively refine the rest of the prompt as a whole in English, 80 words,following the format: Number of characters and gender of characters, [character 1], [character 2], [character ...], everything else in any order. Examples of refined prompt:
- 1man, [young man with ((short gray hair)), black turtleneck sweater, suspenders, singing, smiling, holding a basketball,  a pendant necklace], plain white wall background, focus on him and his actions, anime-style scene
- 2 girls, [one on the left wearing a gray T-shirt holding a laptop in her hand], [one on the right wearing a Wonder Woman costume], anime-style scene
- 1 boy and 1 girl, [Chun-Li from Street Fighter] and [Spider-Man from Marvel movies], engaged in a fierce battle, dynamic fighting poses, action movie poster
- 1 boy and 1 girl, [K-pop male singer (left of center) with short black hair, brown eyes, white color, formal suit with satin lapel and bow tie], [K-pop female singer (center) with long straight black hair, dark brown eyes, white color, formal silver dress], both singers holding hands up in peace signs, anime-style scene, bright colors, sunny background

If the prompt does not contain a character but does contain a clear subject, use the result of the previous step as the beginning and use your imagination to refine the prompt as a whole. The language should be English and the format should be "subject name, everything else in any order."

If the prompt does not contain a character or a clear subject, use your imagination to refine the prompt as a whole, in English.

Step 6: Enclose the result of the previous step within # #

Prompt that need refining:

这个规则大家感兴趣的话可以翻译成中文研究一下,生成逻辑,我坦白这个指令是抄作业抄来的!

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

这是第二步提示词命令生成的提示词,因为它根据指令,给出了每一步的生成过程所以,所以咱们不能把这样没有逻辑的提示词给comfy啊,经过观察真正生成的提示词结果是在##号内!所以有了第卅部!

第三步提取提示词:

是的我们要将##号内的提示词提取出来,提取提示词用这个指令

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

然后你只需要在最前面的cr text节点里输入你要,输入的指令,并把第三个comfyui ollama节点和正向提示词连接即可!

www.zeeklog.com  - 借助ollama实现AI绘画提示词自由,操作简单只需一个节点!

最后放一个祖传的1 girl美女,作为这篇文章的结束

如何学习AI大模型?

作为一名热心肠的互联网老兵,我决定把宝贵的AI知识分享给大家。 至于能学习到多少就看你的学习毅力和能力了 。我已将重要的AI大模型资料包括AI大模型入门学习思维导图、精品AI大模型学习书籍手册、视频教程、实战学习等录播视频免费分享出来。

Read more

前端防范 XSS(跨站脚本攻击)

目录 一、防范措施 1.layui util  核心转义的特殊字符 示例 2.js-xss.js库 安装 1. Node.js 环境(npm/yarn) 2. 浏览器环境 核心 API 基础使用 1. 基础过滤(默认规则) 2. 自定义过滤规则 (1)允许特定标签 (2)允许特定属性 (3)自定义标签处理 (4)自定义属性处理 (5)转义特定字符 常见场景示例 1. 过滤用户输入的评论内容 2. 允许特定富文本标签(如富文本编辑器内容) 注意事项 更多配置 XSS(跨站脚本攻击)是一种常见的网络攻击手段,它允许攻击者将恶意脚本注入到其他用户的浏览器中。

详细教程:如何从前端查看调用接口、传参及返回结果(附带图片案例)

详细教程:如何从前端查看调用接口、传参及返回结果(附带图片案例)

目录 1. 打开浏览器开发者工具 2. 使用 Network 面板 3. 查看具体的API请求 a. Headers b. Payload c. Response d. Preview e. Timing 4. 实际操作步骤 5. 常见问题及解决方法 a. 无法看到API请求 b. 请求失败 c. 跨域问题(CORS) 作为一名后端工程师,理解前端如何调用接口、传递参数以及接收返回值是非常重要的。下面将详细介绍如何通过浏览器开发者工具(F12)查看和分析这些信息,并附带图片案例帮助你更好地理解。 1. 打开浏览器开发者工具 按下 F12 或右键点击页面选择“检查”可以打开浏览器的开发者工具。常用的浏览器如Chrome、Firefox等都内置了开发者工具。下面是我选择我的一篇文章,打开开发者工具进行演示。 2. 使用

Cursor+Codex隐藏技巧:用截图秒修前端Bug的保姆级教程(React/Chakra UI案例)

Cursor+Codex隐藏技巧:用截图秒修前端Bug的保姆级教程(React/Chakra UI案例) 前端开发中最令人头疼的莫过于那些难以定位的UI问题——元素错位、样式冲突、响应式失效...传统调试方式往往需要反复修改代码、刷新页面、检查元素。现在,通过Cursor编辑器集成的Codex功能,你可以直接用截图交互快速定位和修复这些问题。本文将带你从零开始,掌握这套革命性的调试工作流。 1. 环境准备与基础配置 在开始之前,确保你已经具备以下环境: * Cursor编辑器最新版(v2.5+) * Node.js 18.x及以上版本 * React 18项目(本文以Chakra UI 2.x为例) 首先在Cursor中安装Codex插件: 1. 点击左侧扩展图标 2. 搜索"Codex"并安装 3. 登录你的OpenAI账户(需要ChatGPT Plus订阅) 关键配置项: // 在项目根目录创建.