怎么样运用ChatGPT快速构建一个网站模板
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnkQqa915jvibtpsQllrA6c5WDQzKlwF8SCmUZOV2ctlVOw3VEAus0HRSw/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">英文 | https://medium.com/codingthesmartway-com-blog/build-a-complete-website-using-chatgpt-in-1-minute-16edef87bc30</span></p><span style="color: black;">欢迎来到令人兴奋的自然语言处理和<span style="color: black;">设备</span>学习世界!今天,<span style="color: black;">咱们</span>将探索 ChatGPT 的功能,它<span style="color: black;">是由于</span> OpenAI <span style="color: black;">机构</span><span style="color: black;">研发</span>的<span style="color: black;">日前</span>最先进的人工智能工具。当然,你<span style="color: black;">亦</span><span style="color: black;">能够</span>将其看作是一个智能<span style="color: black;">设备</span>人。ChatGPT 最令人印象深刻的功能之一是它能够<span style="color: black;">按照</span>简单的描述生成源代码。</span><span style="color: black;">想象一下,无需自己编写一行一行的代码,就能快速构建一个完整的网站,听起来<span style="color: black;">好似</span>令人难以置信?<span style="color: black;">然则</span>,ChatGPT却能<span style="color: black;">帮忙</span><span style="color: black;">咱们</span>实现<span style="color: black;">这般</span>一个<span style="color: black;">需要</span>,<span style="color: black;">此刻</span>就让<span style="color: black;">咱们</span><span style="color: black;">一块</span>来见证奇迹的<span style="color: black;">出现</span>!</span><span style="color: black;">借助 ChatGPT 的强大功能,<span style="color: black;">咱们</span>将尝试从头<span style="color: black;">起始</span>自动构建一个完整的网站模板结构,并查看结果的准确性和效率。</span><span style="color: black;">该实验不仅展示了 ChatGPT 的功能,还让<span style="color: black;">咱们</span>得以一窥<span style="color: black;">将来</span>技术<span style="color: black;">怎样</span>彻底改变<span style="color: black;">咱们</span><span style="color: black;">研发</span>和构建网站的方式。<span style="color: black;">此刻</span>,让<span style="color: black;">咱们</span><span style="color: black;">一块</span>来深入了解 ChatGPT <span style="color: black;">能够</span>做什么!</span><strong style="color: blue;"><span style="color: black;"><span style="color: black;">咱们</span>要建造什么?</span></strong><span style="color: black;"><span style="color: black;">咱们</span>将<span style="color: black;">运用</span> ChatGPT 构建的网站会在主页上<span style="color: black;">表示</span>一个名为“quotes.txt”的文本文件中的随机引用。</span><span style="color: black;"><span style="color: black;">拜访</span>网站时,应用程序读取 quotes.txt 文件的内容,<span style="color: black;">而后</span>从报价列表中随机<span style="color: black;">选取</span>一条报价并将其传递到前端,并在网页上<span style="color: black;">表示</span>。</span><span style="color: black;"><span style="color: black;">另外</span>,该网页还<span style="color: black;">包括</span>一个标有“更改报价”的按钮,点击后将刷新页面并<span style="color: black;">表示</span>另一个随机报价。</span><span style="color: black;"><span style="color: black;">因此呢</span>,让<span style="color: black;">咱们</span><span style="color: black;">起始</span><span style="color: black;">需求</span> ChatGPT 生成史蒂夫·乔布斯的名言列表:</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnk4lKS9dHeeIKuMyNIQWEQmKVibpUrLibnrGDCsvUvUDIJUMia8mn8ab6PQ/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p><span style="color: black;">接下来<span style="color: black;">咱们</span><span style="color: black;">期盼</span>由 ChatGPT 生成一个网站的页面描述:</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnkPVgw6gcwJJHPCSJssIdY1VdMzgPp57ZiayDs6LgeNHDts0ibpWFvFfWQ/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p><span style="color: black;">基于<span style="color: black;">咱们</span>的文本描述,ChatGPT 正在生成一个全面的响应,它是用 Python 编写的分步说明和源代码,并<span style="color: black;">运用</span> Flask web框架:</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnkTyKSqBuMPR8icALpIRZAocmSgWVTjC74M4R3FgfD0oxDjZvjpMymCBQ/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p><span style="color: black;">为了<span style="color: black;">运用</span><span style="color: black;">供给</span>的代码,<span style="color: black;">咱们</span>必须<span style="color: black;">运用</span>以下命令在这个新项目文件夹中创建一个项目文件夹和文件:</span><span style="color: black;"><span style="color: black;">$</span> mkdir flask-quotes</span><span style="color: black;"><span style="color: black;">$</span> <span style="color: black;">cd</span> flask-quotes</span><span style="color: black;"><span style="color: black;">$</span> touch quotes.txt</span><span style="color: black;"><span style="color: black;">$</span> touch app.py</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">首要</span>,<span style="color: black;">咱们</span>需要将生成的 20 个引号复制到文件 quotes.txt 中。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">接下来,将ChatGPT 为文件app.py <span style="color: black;">供给</span>的源代码复制到其中。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">此代码是 Flask 应用程序的一个基本示例,它在网站主页上<span style="color: black;">表示</span>来自名为“quotes.txt”的文件中的随机引用。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">app = Flask(__name__) 创建一个新的 Flask 应用程序并将其分配给变量 app。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">@app.route(/) 装饰器用于定义网站主页的路由。<span style="color: black;">拜访</span>此路由时调用函数 home()。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在函数内部,脚本<span style="color: black;">运用</span> open() 函数打开“quotes.txt”文件,并<span style="color: black;">运用</span> .readlines() <span style="color: black;">办法</span>将文件内容分配给变量 quotes。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">而后</span>,<span style="color: black;">运用</span> random.choice(quotes) 函数,脚本从报价列表中随机<span style="color: black;">选取</span>一个报价。选定的引用<span style="color: black;">做为</span>名为“quote”的变量传递给返回以在浏览器中呈现的 home.html 模板。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">if __name__ == __main__: 行用于<span style="color: black;">检测</span>脚本是直接运行还是<span style="color: black;">做为</span>模块导入。<span style="color: black;">倘若</span>直接运行,则 app.run(debug=True) 行<span style="color: black;">起步</span><span style="color: black;">研发</span> Web 服务器并运行应用程序。debug=True 参数用于在<span style="color: black;">研发</span><span style="color: black;">时期</span>启用交互式调试器。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">咱们</span>从 ChatGPT 收到的下一条指令<span style="color: black;">能够</span>在以下屏幕截图中看到:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnk1lqg9BltscW2O73WU33A4rqq4MtHclTehpCWkMHPSnHXVE9USqicv8Q/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">让<span style="color: black;">咱们</span><span style="color: black;">根据</span> ChatGPT <span style="color: black;">意见</span>的<span style="color: black;">过程</span>创建一个新文件夹 templates,并在该文件夹中创建一个新文件 home.html:</span></p><span style="color: black;"><span style="color: black;">$</span>mkdir templates</span><span style="color: black;"><span style="color: black;">$</span> touch templates/home.html</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">将 ChatGPT 中的 HTML 代码复制并粘贴到 home.html 中。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这是一个 HTML 页面模板,它<span style="color: black;">表示</span>一个标题为“史蒂夫·乔布斯的名言”的网页,一个<span style="color: black;">拥有</span>相同标题的标题标签,一个<span style="color: black;">表示</span>从后端传递的名言的 div 元素,以及一个标有“更改名言”的按钮,单击它时,重新加载网页。该模板还链接了一个 CSS 文件,用于设置网页样式。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">接下来<span style="color: black;">咱们</span>将收到<span style="color: black;">相关</span>将 CSS 代码<span style="color: black;">包括</span>到 Flask 项目中的说明:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnksEVRDibf2bQKC9AkU0Gf6KeeSkk2lze6QoptNnQiaFYOqlBTib1yur9IA/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">经过</span>输入以下命令再次遵循这些说明:</span></p><span style="color: black;">$ mkdir <span style="color: black;">static</span></span><span style="color: black;">$ touch <span style="color: black;">static</span>/styles.css</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">最后,<span style="color: black;">咱们</span>将 CSS 代码从 ChatGPT 复制并粘贴到 styles.css。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">便是</span><span style="color: black;">这般</span>,<span style="color: black;">咱们</span>准备测试一切<span style="color: black;">是不是</span>按<span style="color: black;">需求</span>工作。输入以下命令<span style="color: black;">起步</span><span style="color: black;">Web </span><span style="color: black;">研发</span>服务器:</span></p><span style="color: black;"><span style="color: black;">$</span> python app.py</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">而后</span>,<span style="color: black;">咱们</span>应该在命令行上看到以下响应:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnk3hqOO6nhypmHWkFMBJ9fVIWZzBg8Ja3Prge3UwFMaDEHiaHmLVrm1icw/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">服务器在本地端口 5000 上运行,接着,在浏览器中输入127.0.0.1:5000就<span style="color: black;">能够</span><span style="color: black;">拜访</span>该网站了:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnkrelqPaPvAhiaUwKNOwC8JmfySXic0dj4T27Zq1eVwdXgUOzzVHeyx5vw/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">此刻</span>,<span style="color: black;">咱们</span>的网站页面就完<span style="color: black;">成为了</span>,<span style="color: black;">经过</span>浏览器,<span style="color: black;">咱们</span>将看到<span style="color: black;">咱们</span><span style="color: black;">期盼</span>的页面输出样式,与<span style="color: black;">咱们</span>的<span style="color: black;">需求</span>完全相符合。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">选取</span>并<span style="color: black;">表示</span>随机报价,<span style="color: black;">咱们</span><span style="color: black;">能够</span><span style="color: black;">运用</span>“Change Quote”按钮随机<span style="color: black;">选取</span>一个新的并更新,<span style="color: black;">咱们</span>将得到以下页面效果:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcbyma1JKhaia8phtB5OTcAnkFJyXI0JNyuMxwAbmlQQb5Im04V61gneYoyV1d4KxRCBkWUTZIw95VQ/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">总结</span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">关于ChatGPT这个AI工具,它<span style="color: black;">能够</span>实现的事情,远不止实现一个网站页面模板,它<span style="color: black;">能够</span>做的事情还非常多,ChatGPT的<span style="color: black;">显现</span>,算是AI<span style="color: black;">行业</span>的一个重大突破,为啥<span style="color: black;">这般</span>说,<span style="color: black;">由于</span>,它的语言模型更加接近人类语言,不会像一个<span style="color: black;">设备</span>人那样死板,它会有所变通,<span style="color: black;">倘若</span>你<span style="color: black;">亦</span><span style="color: black;">爱好</span>AI,热爱<span style="color: black;">设备</span>学习的话,<span style="color: black;">能够</span><span style="color: black;">自动</span>下载安装一个来体验一下,在<span style="color: black;">运用</span>的过程种,用英文语言跟它交流会比用中文更加友好。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">当然,并不是说不<span style="color: black;">能够</span>用中文,中文<span style="color: black;">亦</span><span style="color: black;">同样</span><span style="color: black;">能够</span>的,它做了<span style="color: black;">海量</span>的训练,支持<span style="color: black;">非常多</span>国家的语言。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">好了,今天内容就先分享到<span style="color: black;">这儿</span>了,<span style="color: black;">期盼</span>你会<span style="color: black;">爱好</span>,<span style="color: black;">倘若</span>你觉得有用的话,请记得点赞我,关注我,并将这篇<span style="color: black;">文案</span>分享给你的<span style="color: black;">伴侣</span>,<span style="color: black;">亦</span>许能够<span style="color: black;">帮忙</span>到他。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">学习<span style="color: black;">更加多</span>技能</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;"><span style="color: black;">请点击下方公众号</span></strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><img src="https://mmbiz.qpic.cn/mmbiz/wyice8kFQhf7WrYjynsDMjRbgCwiack4E9nqoERbCmDibsRhEpUq58oKwIEyc4VuxVGROQSQL7lXIrSo2yr3no1IA/640?wx_fmt=gif&tp=webp&wxfrom=5&wx_lazy=1" style="width: 50%; margin-bottom: 20px;"></span></p>
</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_jpg/eXCSRjyNYcZicHX2GeiaDX7s6dicdUJvwu5ibL9rTNXiafbmmILCkhgpCrIGEDgZfl0xSQqDOvGnic3AAB1Pc5YvZknA/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><img src="https://mmbiz.qpic.cn/mmbiz_png/eXCSRjyNYcZdWXMnAPscHBss7aJxHt7Sqdibeu2UncCJCePVqjqrMlhKLJ79whgjRUMuJziajaKuzWZfwicTmPUsg/640?wx_fmt=png&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1" style="width: 50%; margin-bottom: 20px;"></p>
回顾历史,我们感慨万千;放眼未来,我们信心百倍。 期待你更多的精彩评论,一起交流学习。 你的努力一定会被看见,相信自己,加油。
页:
[1]