LLM(六)| Gemini:谷歌Gemini Pro 开放API ,Gemini Pro 可免费使用

       近期,Google Gemini Pro 开放API 了,且Gemini Pro 可免费使用!Gemini Pro支持全球180个国家的38种语言,目前接受文本作为输入并生成文本作为输出。

Gemini API 地址:http://ai.google.dev

       Gemini Pro 的表现超越了其他同类模型,当前版本配备了 32K 文本上下文窗口,可免费使用,且其定价将十分有竞争力。

       具备丰富的功能:函数调用、数据嵌入、语义检索、自定义知识嵌入以及聊天功能。可处理文本输入并生成文本输出,以及专门的 Gemini Pro 视觉多模态终端,能够处理图像和文本输入,输出文本。

       提供多种 SDK,以便开发者在不同平台上构建应用,包括 Python、Android (Kotlin)、Node.js、Swift 和 JavaScript。

       Gemini Pro 提供了易于使用的 SDK,助力开发者在任何平台上快速构建应用。还提供了一个免费的在线开发工具 Google AI Studio,快速构建 Gemini 应用。

Studio :https://makersuite.google.com

Gemini Pro Python API使用

下面将介绍如何使用Python SDK使用Gemini API,具体内容如下:

  1. 设置开发环境和申请Gemini API访问权限;

  2. 根据文本输入生成文本响应;

  3. 从多模式输入(文本和图像)生成文本响应;

  4. 使用Gemini进行多轮对话(聊天);

  5. 使用Gemini进行embedding。

1)设置开发环境和申请Gemini API访问权限

安装相关库

!pip install -q -U google-generativeai

导入相关包

import pathlibimport textwrapimport google.generativeai as genai# Used to securely store your API keyfrom google.colab import userdatafrom IPython.display import displayfrom IPython.display import Markdowndef to_markdown(text):  text = text.replace('•', '  *')  return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True))

设置Gemini API Key

申请API Key地址: https://makersuite.google.com/app/apikey

# Or use `os.getenv('GOOGLE_API_KEY')` to fetch an environment variable.GOOGLE_API_KEY=userdata.get('GOOGLE_API_KEY')genai.configure(api_key=GOOGLE_API_KEY)

查看支持的大模型

for m in genai.list_models():  if 'generateContent' in m.supported_generation_methods:    print(m.name)

2)根据文本输入生成文本响应

model = genai.GenerativeModel('gemini-pro')

       generate_content方法可以处理各种各样的用例,包括多回合聊天和多模式输入,这取决于底层模型支持什么。可用的模型仅支持文本和图像作为输入,文本作为输出。

在最简单的情况下,可以将Prompt字符串传递给GenerativeModel.generate_content方法:

%%timeresponse = model.generate_content("What is the meaning of life?")# 输出CPU times: user 110 ms, sys: 12.3 ms, total: 123 msWall time: 8.25 s

在简单的情况下,response.text访问器就是您所需要的全部。要显示格式化的Markdown文本,请使用To_Markdown功能:

to_markdown(response.text)
The query of life's purpose has perplexed people across centuries, cultures, and continents. While there is no universally recognized response, many ideas have been put forth, and the response is frequently dependent on individual ideas, beliefs, and life experiences.Happiness and Well-being: Many individuals believe that the goal of life is to attain personal happiness and well-being. This might entail locating pursuits that provide joy, establishing significant connections, caring for one's physical and mental health, and pursuing personal goals and interests.Meaningful Contribution: Some believe that the purpose of life is to make a meaningful contribution to the world. This might entail pursuing a profession that benefits others, engaging in volunteer or charitable activities, generating art or literature, or inventing.Self-realization and Personal Growth: The pursuit of self-realization and personal development is another common goal in life. This might entail learning new skills, pushing one's boundaries, confronting personal obstacles, and evolving as a person.Ethical and Moral Behavior: Some believe that the goal of life is to act ethically and morally. This might entail adhering to one's moral principles, doing the right thing even when it is difficult, and attempting to make the world a better place.Spiritual Fulfillment: For some, the purpose of life is connected to spiritual or religious beliefs. This might entail seeking a connection with a higher power, practicing religious rituals, or following spiritual teachings.Experiencing Life to the Fullest: Some individuals believe that the goal of life is to experience all that it has to offer. This might entail traveling, trying new things, taking risks, and embracing new encounters.Legacy and Impact: Others believe that the purpose of life is to leave a lasting legacy and impact on the world. This might entail accomplishing something noteworthy, being remembered for one's contributions, or inspiring and motivating others.Finding Balance and Harmony: For some, the purpose of life is to find balance and harmony in all aspects of their lives. This might entail juggling personal, professional, and social obligations, seeking inner peace and contentment, and living a life that is in accordance with one's values and beliefs.Ultimately, the meaning of life is a personal journey, and different individuals may discover their own unique purpose through their experiences, reflections, and interactions with the world around them.

如果API没有返回结果,可以使用GenerateContentRespose.compt_feedback查看它是否因提示的安全问题而被阻止。

response.prompt_feedback
safety_ratings {  category: HARM_CATEGORY_SEXUALLY_EXPLICIT  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_HATE_SPEECH  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_HARASSMENT  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_DANGEROUS_CONTENT  probability: NEGLIGIBLE}

      Gemini可以对一个提示产生多种可能的反应。这些可能的回答被称为候选者,您可以对其进行审查,以选择最合适的一个作为回答。

使用GenerateContentResponse.candidates查看候选响应:

response.candidates
[content {  parts {    text: "The query of life\'s purpose has perplexed people across centuries, cultures, and continents. While there is no universally recognized response, many ideas have been put forth, and the response is frequently dependent on individual ideas, beliefs, and life experiences.\n\n1. **Happiness and Well-being:** Many individuals believe that the goal of life is to attain personal happiness and well-being. This might entail locating pursuits that provide joy, establishing significant connections, caring for one\'s physical and mental health, and pursuing personal goals and interests.\n\n2. **Meaningful Contribution:** Some believe that the purpose of life is to make a meaningful contribution to the world. This might entail pursuing a profession that benefits others, engaging in volunteer or charitable activities, generating art or literature, or inventing.\n\n3. **Self-realization and Personal Growth:** The pursuit of self-realization and personal development is another common goal in life. This might entail learning new skills, pushing one\'s boundaries, confronting personal obstacles, and evolving as a person.\n\n4. **Ethical and Moral Behavior:** Some believe that the goal of life is to act ethically and morally. This might entail adhering to one\'s moral principles, doing the right thing even when it is difficult, and attempting to make the world a better place.\n\n5. **Spiritual Fulfillment:** For some, the purpose of life is connected to spiritual or religious beliefs. This might entail seeking a connection with a higher power, practicing religious rituals, or following spiritual teachings.\n\n6. **Experiencing Life to the Fullest:** Some individuals believe that the goal of life is to experience all that it has to offer. This might entail traveling, trying new things, taking risks, and embracing new encounters.\n\n7. **Legacy and Impact:** Others believe that the purpose of life is to leave a lasting legacy and impact on the world. This might entail accomplishing something noteworthy, being remembered for one\'s contributions, or inspiring and motivating others.\n\n8. **Finding Balance and Harmony:** For some, the purpose of life is to find balance and harmony in all aspects of their lives. This might entail juggling personal, professional, and social obligations, seeking inner peace and contentment, and living a life that is in accordance with one\'s values and beliefs.\n\nUltimately, the meaning of life is a personal journey, and different individuals may discover their own unique purpose through their experiences, reflections, and interactions with the world around them."  }  role: "model"}finish_reason: STOPindex: 0safety_ratings {  category: HARM_CATEGORY_SEXUALLY_EXPLICIT  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_HATE_SPEECH  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_HARASSMENT  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_DANGEROUS_CONTENT  probability: NEGLIGIBLE}]

       默认情况下,模型在完成整个生成过程后返回一个响应。您还可以在生成响应时对其进行流式传输,一旦生成响应,模型就会返回响应块。

要流式传输响应,请使用GenerativeModel.generate_content(…,stream=True)。

%%timeresponse = model.generate_content("What is the meaning of life?", stream=True)
CPU times: user 102 ms, sys: 25.1 ms, total: 128 msWall time: 7.94 s
for chunk in response:  print(chunk.text)  print("_"*80)
The query of life's purpose has perplexed people across centuries, cultures, and________________________________________________________________________________ continents. While there is no universally recognized response, many ideas have been put forth, and the response is frequently dependent on individual ideas, beliefs, and life experiences________________________________________________________________________________.1. **Happiness and Well-being:** Many individuals believe that the goal of life is to attain personal happiness and well-being. This might entail locating pursuits that provide joy, establishing significant connections, caring for one's physical and mental health, and pursuing personal goals and aspirations.2. **Meaning________________________________________________________________________________ful Contribution:** Some believe that the purpose of life is to make a meaningful contribution to the world. This might entail pursuing a profession that benefits others, engaging in volunteer or charitable activities, generating art or literature, or inventing.3. **Self-realization and Personal Growth:** The pursuit of self-realization and personal development is another common goal in life. This might entail learning new skills, exploring one's interests and abilities, overcoming obstacles, and becoming the best version of oneself.4. **Connection and Relationships:** For many individuals, the purpose of life is found in their relationships with others. This might entail building________________________________________________________________________________ strong bonds with family and friends, fostering a sense of community, and contributing to the well-being of those around them.5. **Spiritual Fulfillment:** For those with religious or spiritual beliefs, the purpose of life may be centered on seeking spiritual fulfillment or enlightenment. This might entail following religious teachings, engaging in spiritual practices, or seeking a deeper understanding of the divine.6. **Experiencing the Journey:** Some believe that the purpose of life is simply to experience the journey itself, with all its joys and sorrows. This perspective emphasizes embracing the present moment, appreciating life's experiences, and finding meaning in the act of living itself.7. **Legacy and Impact:** For others, the goal of life is to leave a lasting legacy or impact on the world. This might entail making a significant contribution to a particular field, leaving a positive mark on future generations, or creating something that will be remembered and cherished long after one's lifetime.Ultimately, the meaning of life is a personal and subjective question, and there is no single, universally accepted answer. It is about discovering what brings you fulfillment, purpose, and meaning in your own life, and living in accordance with those values.________________________________________________________________________________

流式传输时,在迭代完所有响应块之后,某些响应属性才可用。如下所示:

response = model.generate_content("What is the meaning of life?", stream=True)
# prompt_feedback属性可以使用response.prompt_feedback
safety_ratings {  category: HARM_CATEGORY_SEXUALLY_EXPLICIT  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_HATE_SPEECH  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_HARASSMENT  probability: NEGLIGIBLE}safety_ratings {  category: HARM_CATEGORY_DANGEROUS_CONTENT  probability: NEGLIGIBLE}
# text属性不可用try:  response.textexcept Exception as e:  print(f'{type(e).__name__}: {e}')
IncompleteIterationError: Please let the response complete iteration before accessing the final accumulatedattributes (or call `response.resolve()`)

3)从多模式输入(文本和图像)生成文本响应

      Gemini提供了一个多模态模型(Gemini-pro-vision),可以接受文本、图像和输入。GenerativeModel.generate_content API用于处理多模态Prompt并返回文本输出。

下载一张图片:

!curl -o image.jpg https://t0.gstatic.com/licensed-image?q=tbn:ANd9GcQ_Kevbk21QBRy-PgB4kQpS79brbmmEG7m3VOTShAn4PecDU5H5UxrJxE3Dw1JiaG17V88QIol19-3TM2wCHw

查看该图片:

import PIL.Imageimg = PIL.Image.open('image.jpg')img

使用gemini-pro-vision模型,并将图像传递给generate_content模型。

model = genai.GenerativeModel('gemini-pro-vision')
response = model.generate_content(img)to_markdown(response.text)
Chicken Teriyaki Meal Prep Bowls with brown rice, roasted broccoli and bell peppers.

在Prompt中同时输入文本和图像,需要把字符串和图像以list格式输入:

response = model.generate_content(["Write a short, engaging blog post based on this picture. It should include a description of the meal in the photo and talk about my journey meal prepping.", img], stream=True)response.resolve()
to_markdown(response.text)
Meal prepping is a great way to save time and money, and it can also help you to eat healthier. This meal is a great example of a healthy and delicious meal that can be easily prepped ahead of time.This meal features brown rice, roasted vegetables, and chicken teriyaki. The brown rice is a whole grain that is high in fiber and nutrients. The roasted vegetables are a great way to get your daily dose of vitamins and minerals. And the chicken teriyaki is a lean protein source that is also packed with flavor.This meal is easy to prepare ahead of time. Simply cook the brown rice, roast the vegetables, and cook the chicken teriyaki. Then, divide the meal into individual containers and store them in the refrigerator. When you're ready to eat, simply grab a container and heat it up.This meal is a great option for busy people who are looking for a healthy and delicious way to eat. It's also a great meal for those who are trying to lose weight or maintain a healthy weight.If you're looking for a healthy and delicious meal that can be easily prepped ahead of time, this meal is a great option. Give it a try today!

4)使用Gemini进行多轮对话(聊天)

       Gemini支持多轮对话。ChatSession类通过管理会话的状态来简化过程,这与generate_content不同,不必将会话历史记录存储为列表。

初始化聊天:

model = genai.GenerativeModel('gemini-pro')chat = model.start_chat(history=[])chat
<google.generativeai.generative_models.ChatSession at 0x7b7b68250100>

PS:视觉模型gemini-pro-vision没有针对多轮对话优化。

ChatSession.send_message方法返回与GenerativeModel.generate_content相同的GenerateContentResponse类型,还将您的消息和响应附加到聊天历史记录中:

response = chat.send_message("In one sentence, explain how a computer works to a young child.")to_markdown(response.text)# 输出A computer is like a very smart machine that can understand and follow our instructions, help us with our work, and even play games with us!
chat.history# 输出[parts {   text: "In one sentence, explain how a computer works to a young child." } role: "user", parts {   text: "A computer is like a very smart machine that can understand and follow our instructions, help us with our work, and even play games with us!" } role: "model"]

使用stream=True参数可以设置流式传输聊天,可以持续输入内容:

response = chat.send_message("Okay, how about a more detailed explanation to a high schooler?", stream=True)for chunk in response:  print(chunk.text)  print("_"*80)# 输出A computer works by following instructions, called a program, which tells it what to________________________________________________________________________________ do. These instructions are written in a special language that the computer can understand, and they are stored in the computer's memory. The computer's processor________________________________________________________________________________, or CPU, reads the instructions from memory and carries them out, performing calculations and making decisions based on the program's logic. The results of these calculations and decisions are then displayed on the computer's screen or stored in memory for later use.To give you a simple analogy, imagine a computer as a________________________________________________________________________________ chef following a recipe. The recipe is like the program, and the chef's actions are like the instructions the computer follows. The chef reads the recipe (the program) and performs actions like gathering ingredients (fetching data from memory), mixing them together (performing calculations), and cooking them (processing data). The final dish (the output) is then presented on a plate (the computer screen). In summary, a computer works by executing a series of instructions, stored in its memory, to perform calculations, make decisions, and display or store the results. ________________________________________________________________________________

      glm.Content对象包含一个glm.Part对象列表。每个glm.Part对象都包含text(字符串)或inline_data(glm.Blob),其中blob包含二进制数据和mime_type。聊天历史记录在以glm.Content列表的形式存储在ChatSession.history对象中:

for message in chat.history:  display(to_markdown(f'**{message.role}**: {message.parts[0].text}'))# 输出user: In one sentence, explain how a computer works to a young child.model: A computer is like a very smart machine that can understand and follow our instructions, help us with our work, and even play games with us!user: Okay, how about a more detailed explanation to a high schooler?model: A computer works by following instructions, called a program, which tells it what to do. These instructions are written in a special language that the computer can understand, and they are stored in the computer's memory. The computer's processor, or CPU, reads the instructions from memory and carries them out, performing calculations and making decisions based on the program's logic. The results of these calculations and decisions are then displayed on the computer's screen or stored in memory for later use.To give you a simple analogy, imagine a computer as a chef following a recipe. The recipe is like the program, and the chef's actions are like the instructions the computer follows. The chef reads the recipe (the program) and performs actions like gathering ingredients (fetching data from memory), mixing them together (performing calculations), and cooking them (processing data). The final dish (the output) is then presented on a plate (the computer screen).In summary, a computer works by executing a series of instructions, stored in its memory, to perform calculations, make decisions, and display or store the results.

5)使用Gemini进行embedding

      使用embed_content方法生成embedding,可以对以下任务(task_type)进行embedding:

Task TypeDescription
RETRIEVAL_QUERYSpecifies the given text is a query in a search/retrieval setting.
RETRIEVAL_DOCUMENTSpecifies the given text is a document in a search/retrieval setting. Using this task type requires a title.
SEMANTIC_SIMILARITYSpecifies the given text will be used for Semantic Textual Similarity (STS).
CLASSIFICATIONSpecifies that the embeddings will be used for classification.
CLUSTERINGSpecifies that the embeddings will be used for clustering.

下面为文档检索生成单个字符串的embedding:

result = genai.embed_content(    model="models/embedding-001",    content="What is the meaning of life?",    task_type="retrieval_document",    title="Embedding of single string")# 1 input > 1 vector outputprint(str(result['embedding'])[:50], '... TRIMMED]')
[-0.003216741, -0.013358698, -0.017649598, -0.0091 ... TRIMMED]

PS:retrieval_document任务类型是唯一接受标题的任务。

可以在content中传入一个字符串列表来对字符串进行批处理:

result = genai.embed_content(    model="models/embedding-001",    content=[      'What is the meaning of life?',      'How much wood would a woodchuck chuck?',      'How does the brain work?'],    task_type="retrieval_document",    title="Embedding of list of strings")# A list of inputs > A list of vectors outputfor v in result['embedding']:  print(str(v)[:50], '... TRIMMED ...')
[0.0040260437, 0.004124458, -0.014209415, -0.00183 ... TRIMMED ...[-0.004049845, -0.0075574904, -0.0073463684, -0.03 ... TRIMMED ...[0.025310587, -0.0080734305, -0.029902633, 0.01160 ... TRIMMED ...

      虽然genai.embedd_content函数接受简单的字符串或字符串列表,但它实际上是围绕glm.Content类型构建的(比如GemerativeModel.generate_content)。glm.Content 在会话API中通常用来初始化会话。

       然而,glm.Content对象是多模态的,embedd_content方法只支持文本嵌入。这种设计为API提供了扩展到多模式嵌入的可能性。

response.candidates[0].content#输出parts {  text: "A computer works by following instructions, called a program, which tells it what to do. These instructions are written in a special language that the computer can understand, and they are stored in the computer\'s memory. The computer\'s processor, or CPU, reads the instructions from memory and carries them out, performing calculations and making decisions based on the program\'s logic. The results of these calculations and decisions are then displayed on the computer\'s screen or stored in memory for later use.\n\nTo give you a simple analogy, imagine a computer as a chef following a recipe. The recipe is like the program, and the chef\'s actions are like the instructions the computer follows. The chef reads the recipe (the program) and performs actions like gathering ingredients (fetching data from memory), mixing them together (performing calculations), and cooking them (processing data). The final dish (the output) is then presented on a plate (the computer screen).\n\nIn summary, a computer works by executing a series of instructions, stored in its memory, to perform calculations, make decisions, and display or store the results."}role: "model"
result = genai.embed_content(    model = 'models/embedding-001',    content = response.candidates[0].content)# 1 input > 1 vector outputprint(str(result['embedding'])[:50], '... TRIMMED ...')#输出[-0.013921871, -0.03504407, -0.0051786783, 0.03113 ... TRIMMED ...

      同样,聊天历史记录也包含一个glm.Content对象列表。可以直接传递给embed_content函数:

chat.history# 输出[parts {   text: "In one sentence, explain how a computer works to a young child." } role: "user", parts {   text: "A computer is like a very smart machine that can understand and follow our instructions, help us with our work, and even play games with us!" } role: "model", parts {   text: "Okay, how about a more detailed explanation to a high schooler?" } role: "user", parts {   text: "A computer works by following instructions, called a program, which tells it what to do. These instructions are written in a special language that the computer can understand, and they are stored in the computer\'s memory. The computer\'s processor, or CPU, reads the instructions from memory and carries them out, performing calculations and making decisions based on the program\'s logic. The results of these calculations and decisions are then displayed on the computer\'s screen or stored in memory for later use.\n\nTo give you a simple analogy, imagine a computer as a chef following a recipe. The recipe is like the program, and the chef\'s actions are like the instructions the computer follows. The chef reads the recipe (the program) and performs actions like gathering ingredients (fetching data from memory), mixing them together (performing calculations), and cooking them (processing data). The final dish (the output) is then presented on a plate (the computer screen).\n\nIn summary, a computer works by executing a series of instructions, stored in its memory, to perform calculations, make decisions, and display or store the results." } role: "model"]
result = genai.embed_content(    model = 'models/embedding-001',    content = chat.history)# 1 input > 1 vector outputfor i,v in enumerate(result['embedding']):  print(str(v)[:50], '... TRIMMED...')
[-0.014632266, -0.042202696, -0.015757175, 0.01548 ... TRIMMED...[-0.010979066, -0.024494737, 0.0092659835, 0.00803 ... TRIMMED...[-0.010055617, -0.07208932, -0.00011750793, -0.023 ... TRIMMED...[-0.013921871, -0.03504407, -0.0051786783, 0.03113 ... TRIMMED...

参考文献:

[1] https://ai.google.dev/

[2] makersuite.google.com

[3] https://ai.google.dev/docs?hl=zh-cn

[4] https://colab.research.google.com/github/google/generative-ai-docs/blob/main/site/en/tutorials/python_quickstart.ipynb#scrollTo=GMUvWNkZ11x4

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/247295.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Linux route命令详解

1、介绍 route命令用于显示和操作IP路由表&#xff0c;它允许用户查看当前系统的路由信息&#xff0c;添加新的路由、删除已有的路由等。 2、命令 2.1 命令选项 -n, --numeric&#xff1a;不解析主机名&#xff0c;直接显示IP地址。使用这个选项可以加快显示速度&#xff0…

Git忽略已经提交的文件

原理类似于 Android修改submodule的lib包名

“唯品会API接口:电商开发者的秘密武器”

一、引言 唯品会作为一家知名的电商平台&#xff0c;提供了丰富的API接口供开发者使用。通过使用唯品会的API接口&#xff0c;开发者可以轻松地与唯品会平台进行交互&#xff0c;实现自动化处理、数据抓取等功能。本文将详细介绍唯品会API接口的使用方法、技术细节以及注意事项…

C语言->动态内存管理

系列文章目录 文章目录 前言 ✅作者简介&#xff1a;大家好&#xff0c;我是橘橙黄又青&#xff0c;一个想要与大家共同进步的男人&#x1f609;&#x1f609; &#x1f34e;个人主页&#xff1a;橘橙黄又青_C语言,函数,指针-CSDN博客 目的&#xff1a;学习malloc&#xff0c…

【思考】只有实对称矩阵才能正交对角化吗?【矩阵的合同】

1&#xff1a;命题改写&#xff08;A可以正交对角化&#xff09; 2&#xff1a;左乘Q右乘Q逆&#xff08;Q转置&#xff09; 3&#xff1a;取转置 4&#xff1a;得证 总结 可以看到&#xff0c;矩阵如果可以正交对角化&#xff0c;那么一定是实对称矩阵。 另外&#xff0c;这…

shopee选品软件:如何利用Shopee选品软件优化你的销售业绩

在当今的电商市场中&#xff0c;选择适销的产品是成功的关键之一。然而&#xff0c;对于卖家来说&#xff0c;如何找到有潜力的产品并优化销售策略是一个具有挑战性的任务。幸运的是&#xff0c;有许多Shopee选品软件可以帮助卖家在Shopee平台上进行产品分析和选择。本文将介绍…

WPF 基于TableControl的页面切换

文章目录 前言其它项目的UserControl切换TableControl添加按钮&#xff0c;隐去TableItem的Header 结论 前言 我想用WPF简单实现一个按钮视图切换的效果&#xff0c;但是我发现别人的实现效果非常的麻烦。 其它项目的UserControl切换 我网上找了个开源的项目&#xff0c;他是…

100ask imx6ull 驱动(设备树)装载步骤

1.修改设备树文件 路径&#xff1a; vim 100ask_imx6ull-sdk/Linux-4.9.88/arch/arm/boot/dts/100ask_imx6ull-14x14.dtb 2. 回到linux内核目录下&#xff0c;执行命令 /*路径&#xff1a;100ask_imx6ull-sdk/Linux-4.9.88*/ make dtbs 将生成的arch/arm/boot/dts/100ask_…

【Spring】@SpringBootApplication注解解析

前言&#xff1a; 当我们第一次创建一个springboot工程时&#xff0c;我们会对启动类&#xff08;xxxApplication&#xff09;有许多困惑&#xff0c;为什么只要运行启动类我们在项目中自定义的bean无需配置类配置&#xff0c;扫描就能自动注入到IOC容器中&#xff1f;为什么我…

解决el-table组件中,分页后数据的勾选、回显问题?

问题描述&#xff1a; 1、记录一个弹窗点击确定按钮后&#xff0c;table列表所有勾选的数据信息2、再次打开弹窗&#xff0c;回显勾选所有保存的数据信息3、遇到的bug&#xff1a;切换分页&#xff0c;其他页面勾选的数据丢失&#xff1b;点击确认只保存当前页的数据&#xff1…

迅为RK3588开发板瑞芯微国产化工业ARM核心板AI人工智能

性能强 iTOP-3588开发板采用瑞芯微RK3588处理器&#xff0c;是全新一代AloT高端应用芯片&#xff0c;采用8nm LP制程&#xff0c;搭载八核64位CPU&#xff0c;四核Cortex-A76和四核Cortex-A55架构&#xff0c;主频高达2.4GHz&#xff0c;8GB内存&#xff0c;32GB EMMC。 四核心…

ACL和NAT

文章目录 ACL和NAT一、ACL概述及产生背景1、ACL访问控制列表2、ACL工作原理3、ACL种类4、ACL命令配置步骤4.1 ACL命令配置4.1 ACL配置步骤 二、NAT&#xff08;网络地址转换&#xff09;1、NAT概述2、NAT类型2.1 静态NAT与动态NAT 3、NATPT&#xff08;端口映射&#xff09;4、…

成都工业学院Web技术基础(WEB)实验二:HTML5表格、表单标签的使用

写在前面 1、基于2022级计算机大类实验指导书 2、代码仅提供参考&#xff0c;前端变化比较大&#xff0c;按照要求&#xff0c;只能做到像&#xff0c;不能做到一模一样 3、图片和文字仅为示例&#xff0c;需要自行替换 4、如果代码不满足你的要求&#xff0c;请寻求其他的…

Arduino使用定时器设置周期时间运行程序

1、用Arduino millis() 函数 实现一定程度上的多任务系统&#xff0c;可以设置不同时间的任务周期去执行对应的程序。比如需要10毫秒执行一次的程序、100毫秒执行一次的程序、1秒执行一次的程序。 2、Delay(ms)是延时函数&#xff0c;使用该延时函数&#xff0c;后面的程序将会…

租一台服务器多少钱决定服务器的价格因素有哪些

租一台服务器多少钱决定服务器的价格因素有哪些 大家好我是艾西&#xff0c;服务器这个名词对于不从业网络行业的人们看说肯定还是比较陌生的。在21世纪这个时代发展迅速的年代服务器在现实生活中是不可缺少的一环&#xff0c;平时大家上网浏览自己想要查询的信息等都是需要服…

统信UOS上图形化配置系统和应用代理

原文链接&#xff1a;统信UOS上图形化配置系统和应用代理 hello&#xff0c;大家好啊&#xff0c;今天我要给大家介绍的是在统信UOS操作系统上如何通过图形化界面配置系统代理和应用代理。在许多公司的内网环境中&#xff0c;直接访问互联网可能受到限制&#xff0c;但通常会提…

关于linux 磁盘占用排查问题

1.关于磁盘 查看整体磁盘占用大小 df -h 2. 先排除mysql 数据大小 查询库的大小 SELECT table_schema AS "Database", ROUND(SUM(data_length index_length) / 1024 / 1024, 2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema…

ACL与NAT

目录 一、ACL &#xff08;一&#xff09;ACL基本理论 &#xff08;二&#xff09;ACL的类型 1.基本ACL 2.高级ACL 3.二层ACL &#xff08;三&#xff09;基本原理 &#xff08;四&#xff09;项目实验 通配符掩码 二、NAT &#xff08;一&#xff09;基本理论 &am…

【XR806开发板试用】+Linux小白上手开发笔记(2)——阿里云云方案

##0、前言 在之前文章中提到&#xff0c;在windows中搭建unbuntu对于新手小白来说非常不友好。因此一直在找解决方案&#xff0c;找到一条非常有意思的方案。希望对大家有点帮助。 1、环境搭建 方案核心————阿里云云 具体步骤如下&#xff1a; step1&#xff1a;注册。由…
最新文章