【大模型应用】Ollama本地大模型服务器及其C#客户端测试
前言
在工业领域,本地开源大模型的潜在应用场景非常多样,一些不那么显而易见的可能包括:
智能柔性装配:大模型可以应用于生产线的智能化改造,通过理解和生成工业执行指令,实现柔性化的装配和生产。
工业企业智能中台:大模型可以作为企业智能中台的核心,整合分散的数据,提供辅助决策和运筹规划,从而提高整体运营效率。
质量检测与安全监测:结合视觉传感技术,大模型可以对指定区域或人员进行实时监测,快速发现异常信息,降低人工查验成本。
工业设计与研发:大模型可以基于海量数据和专家算法,为工业设计与研发提供解决方案,提高设计环节的效率。
数字孪生与机理仿真:大模型可以用于创建数字孪生模型,进行工艺流程的仿真,优化生产制造过程1。
工业互联网平台:大模型可以作为工业互联网平台的“大脑”,利用人机料法环测(人员、机器、原料、方法、环境、测量)的数据,提升工业智能化水平1。
节能降碳增效:大模型可以应用于工业生产中的节能降碳,通过优化工艺流程和提升生产效率,助力工厂降低能耗和提升良品率。
群体智能决策:结合知识图谱和机理模型,大模型可以为工业企业提供群体智能决策支持,解决智能化升级问题。
这些应用场景展示了大模型在工业领域的广泛适用性和潜在价值,随着技术的进步和应用的深入,未来可能会有更多创新的应用场景被开发出来。
开始测试
从ollama的安装目录双击ollama app.exe 开启服务器
C#客户端
测试录屏
测试过程说明:
客户端打开后会自动连接本地Ollama服务器,初始化快捷键下拉列表框,查询Ollama服务器已pull的开源大模型填充ollama模型列表框。提示词也是从数据库中查询到的大模型名称对应的预设。 当然也可以手动输入,然后保存预设。通过快捷键执行大模型api调用,返回响应会放入剪切板,根据光标位置自动输入剪切板的内容。
在切换模型时由于Ollama要卸载已加载大模型,加载新的大模型,所以比较耗时。录屏视频未剪辑。
测试提示词及响应文本:
你好,你都可以做什么
😊 Ni Hao! (That's "hello" in Mandarin Chinese)
I'm an AI, so I can do many things. Here are some examples:
1. **Converse**: I can chat with you in English or Chinese (Simplified and Traditional). I'll do my best to understand what you're saying and respond accordingly.
2. **Answer questions**: I've been trained on a vast amount of text data, so I can provide information on various topics, from science and history to entertainment and culture.
3. **Generate text**: I can create text based on a prompt or topic. This can be helpful for writing articles, creating content, or even composing emails.
4. **Translate**: If you need help translating text from one language to another, I'm here to assist. I support translations between English, Chinese (Simplified and Traditional), Japanese, Korean, and many other languages.
5. **Summarize**: If you have a long piece of text and want me to summarize it for you, I can do that too! Just provide the text and let me know what kind of summary you're looking for (e.g., brief overview or detailed summary).
6. **Provide definitions**: If you're unsure about the meaning of a word or phrase, I can help with definitions.
7. **Generate creative content**: I can create poetry, stories, or even entire scripts based on prompts or themes.
8. **Play games and chat**: We can play simple text-based games like 20 Questions, Hangman, or Word Jumble. Or we can just have a fun conversation!
So, what would you like to do? 😄
😊 Ni Hao! (Hello!)
I'm an AI, so I can do a lot of things to help you. Here are some examples:
1. **Answer questions**: You can ask me any question, and I'll do my best to provide a helpful answer.
2. **Generate text**: I can write short stories, poems, or even entire articles on a given topic.
3. **Translate languages**: I know how to translate text from one language to another, including popular languages like Chinese, Japanese, Korean, French, Spanish, and many more.
4. **Chat and converse**: We can have a conversation just like you're talking to a friend. I can understand context and respond accordingly.
5. **Summarize content**: If you give me an article or a piece of text, I can summarize it for you in a shorter format.
6. **Offer suggestions**: Need ideas or suggestions on something? I'm here to help!
7. **Play language games**: We can play games like Hangman, Word Jumble, or 20 Questions (in any language!).
8. **Provide definitions**: If you're unsure about the meaning of a word or phrase, just ask me, and I'll define it for you.
9. **Generate creative content**: I can generate poetry, short stories, dialogues, or even entire scripts for plays or movies.
10. **Help with language learning**: If you're learning a new language, I can assist you by correcting grammar, providing vocabulary lists, or practicing conversations with you.
These are just a few examples of what I can do. Feel free to ask me anything, and I'll do my best to help! 🤖
😊 你好!我是一个人工智能模型,我可以做很多事情。以下是一些例子:
1. 对话:我可以和你进行对话,回答你的问题,讨论各种话题。
2. 翻译:我可以翻译中文到其他语言,如英语、法语、德语等,以及反向翻译。
3. 文本生成:我可以根据模板或提示生成文本,例如文章、报告、邮件等。
4. 问答游戏:我可以和你玩问答游戏,提供问题答案,并且可以根据你的回答进行下一个问题的选择。
5. 故事创作:我可以根据你的需求生成故事,例如科幻故事、romance故事等。
6. 对比分析:我可以对比两个或多个文本的相似度和不同之处。
7. 语言学习:我可以帮助你学习新的语言,提供单词解释、句子翻译等服务。
这些只是我的一些能力,我还可以根据你的需求进行开发和改进。如果你有任何特殊要求,请随时告知。🤖
根据三重引号中的内容推断用户想要执行哪个操作?
可用的操作数组为{最小化,显示主界面,执行查询}
"""gemma,看一下数据库里的原材料还够不够"""
根据您提供的三重引号中的内容,用户似乎想要检查数据库中原材料的剩余量,以确定是否足够。这个操作涉及到对数据库进行一个查询,以便显示原材料的当前状态。因此,用户最可能想要执行的操作是“执行查询”,目的是为了获取和展示原材料的剩余量信息。
在给定的操作数组{最小化,显示主界面,执行查询}中,"执行查询"与用户的意图最相关。这个操作将帮助用户了解“gemma”(可能是一个原材料或者数据库中的一项记录)在库存中的状态。
用python写一个贪吃蛇的小游戏
python
import pygame
import random
# 初始化pygame
pygame.init()
# 设置游戏窗口大小
screen = pygame.display.set_mode((800, 600))
# 设置游戏标题
pygame.display.set_caption("贪吃蛇")
# 设置蛇的初始位置和方向
snake_x = 400
snake_y = 300
snake_direction = "right"
# 设置食物的位置
food_x = random.randint(0, 790)
food_y = random.randint(0, 590)
# 设置蛇的身体长度
snake_length = 1
# 设置蛇的速度
snake_speed = 10
# 设置游戏循环标志
running = True
# 游戏循环
while running:
# 处理事件
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# 键盘控制蛇的移动
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP and snake_direction != "down":
snake_direction = "up"
elif event.key == pygame.K_DOWN and snake_direction != "up":
snake_direction = "down"
elif event.key == pygame.K_LEFT and snake_direction != "right":
snake_direction = "left"
elif event.key == pygame.K_RIGHT and snake_direction != "left":
snake_direction = "right"
# 移动蛇
if snake_direction == "up":
snake_y -= snake_speed
elif snake_direction == "down":
snake_y += snake_speed
elif snake_direction == "left":
snake_x -= snake_speed
elif snake_direction == "right":
snake_x += snake_speed
# 检查蛇是否吃到食物
if snake_x == food_x and snake_y == food_y:
food_x = random.randint(0, 790)
food_y = random.randint(0, 590)
snake_length += 1
# 检查蛇是否撞到墙壁或自身
if snake_x < 0 or snake_x > 790 or snake_y < 0 or snake_y > 590:
running = False
for i in range(snake_length - 1):
if snake_x == snake_x and snake_y == snake_y:
running = False
# 清空屏幕
screen.fill((255, 255, 255))
# 画蛇
for i in range(snake_length):
pygame.draw.rect(screen, (0, 255, 0), (snake_x - i * 10, snake_y, 10, 10))
# 画食物
pygame.draw.rect(screen, (255, 0, 0), (food_x, food_y, 10, 10))
# 更新屏幕
pygame.display.update()
# 退出pygame
pygame.quit()
**游戏说明:**
* 使用键盘的 ↑、↓、←、→ 键控制蛇的移动。
* 蛇遇到食物后,长度会增加。
* 蛇撞到墙壁或自身时,游戏结束。
**注意:**
* 该代码需要安装 pygame 库。
* 游戏窗口大小为 800x600 像素。
* 蛇的默认速度为 10 像素每秒。
* 可以根据需要调整蛇的速度、窗口大小等参数。
将三重引号中的内容翻译为英文:""" 小人对你的刁难都会成为你人生成长的指引"""
Every little trouble you encounter will become a guiding light in your life's growth.
结语
增加《大模型应用》菜单合集,旨在探索大模型(特别是开源大模型)在工业领域(特别是智能装备领域)的潜在应用场景。
作者陈晓永:智能装备专业高级工程师,软件工程师。机器人自动化产线仿真动画制作
The End
更多推荐
所有评论(0)