GPT 4o- with Canvas:让我们创建一个金融流应用程序

ChatGPT 今年发布了多个模型,因此有很多可以探索和利用的内容。

在本文中,我们将探索 GPT 4o 和 Canvas 模型,并构建一个预测股票价格的 Streamlit 应用。听起来很有趣,对吧?我也很兴奋,因为我在写作过程中也会尝试,所以让我们一起探索吧。

GPT 4o- with Canvas

在这里插入图片描述

首先,让我们在 ChatGPT 的左上角选择 GPT 4o-with Canvas 模型。如果你不知道 GPT 4o- with canvas 是什么,可以查看下面的图片。这里你可以看到如何构建 streamlit 应用。

在这里插入图片描述

但是什么是 streamlit?

Streamlit

在这里插入图片描述

Streamlit 是一种极其有用且快速的方法,可以在几分钟内构建你的 Web 应用——是的,几分钟!但如何实现?让我们开始吧!

步骤 1: 创建一个 Github 仓库

前往你的 GitHub 并创建一个仓库。

在这里插入图片描述

步骤 2: 在此仓库中创建一个 .py 文件

将以下代码粘贴进去。

## Importing the required libraries
import streamlit as st

## What is Streamlit?
## Streamlit is an open-source Python library that makes it easy to build custom web apps for data science, machine learning, and general interactive purposes.
## It is popular because it enables rapid prototyping and deployment of web-based dashboards and applications without the need for extensive web development knowledge.

## Title of the Streamlit App
st.title('Simple Streamlit App')

## Adding some text description
st.write("Hello, this is a simple Streamlit application!")

## A number input box for user interaction
user_input = st.number_input('Enter a number:', value=0)

## Displaying the value entered by the user
st.write(f'You entered: {user_input}')

## Adding a button to the interface
if st.button('Click Me!'):
    st.write('You clicked the button!')

## Explanation
## Streamlit apps run on the local server, and they allow you to build interactive components like buttons, sliders, and text inputs
## simply by using Python code. This makes it a go-to tool for data scientists to showcase their models or explore datasets interactively.

在这里插入图片描述

步骤 3: 前往你的 Streamlit 账户

如果你还没有账户,创建一个。点击右上角的“创建应用”。

在这里插入图片描述

选择从 GitHub 部署一个公共应用。

在这里插入图片描述

选择你的 GitHub 仓库并点击部署。

在这里插入图片描述

大功告成!不到 5 分钟,你的应用就完成了。

在这里插入图片描述

现在,如果你想在本地环境中测试这个应用,将文件保存为 Python 文件并使用以下代码。

streamlit run finance_app.py

你将看到相同的界面,请检查。

在这里插入图片描述

很好。让我们继续使用 GPT 4o — with canvas 来完善我们的应用,并在本地环境中进行测试。然而,要创建一个带有 GPT 4o-with canvas 的应用,我们需要一个良好的提示,这里我们可以使用 Prompt Perfector GPT。

在这里插入图片描述

这是我要发送给 Prompt Perfector GPT 的提示。

I want to build a Streamlit app for finance.
This app should be able to predict upcoming prices 
(a 1-week prediction based on the given data).
We will use the Yahoo Finance API, and this prediction should be done 
using ML models like LSTM or any other model suitable for this task.

这是它如何为我们创建一个完美的提示和提示优化步骤。

在这里插入图片描述
在这里插入图片描述

我进行了几项优化,所以这是结果。

在这里插入图片描述

很好,现在我们还有最后一步:从 这里 获取 Yahoo 财经 API。

在这里插入图片描述

现在,如果你还没有注册 RapidAPI,注册并收集你的 API 密钥,让我们开始吧!

财务APP

在这一阶段,使用上述提示,但在最后添加以下内容。这是提示。

Develop a Streamlit app for financial forecasting that predicts the prices of stocks for the upcoming week using machine learning models, such as Long Short-Term Memory (LSTM) networks or other suitable algorithms. The app should integrate with the Yahoo Finance API to fetch historical stock data and provide predictions based on the data retrieved.

The app should include:

Adjustable Parameters:

Allow users to select a stock ticker symbol.
Use date pickers for specifying the historical data range.
Provide options for configuring ML model parameters, such as training epochs, LSTM layers, or batch size.
Data Visualization:

Display clear line graphs of historical stock data and overlay the predicted prices on the same chart.
Use Plotly for interactive and zoomable graphs.
Result Download:

Include a "Download as CSV" feature for historical and predicted data with timestamps, actual prices, and predicted prices.
Performance Optimization:

Implement Streamlit caching to store API responses temporarily, minimizing repetitive calls and enhancing app speed.
Deployment Ready:

Ensure the app is deployable via Streamlit Cloud using a GitHub repository.
Include detailed instructions on setting up the app, linking to the GitHub repo, and setting Yahoo Finance API keys if required.
The app should be user-friendly, with proper error handling for invalid inputs or network issues. Add a brief “How it works” section to explain the app’s features, and ensure that all components are optimized for scalability and reliability.
Do it in canvas.

这里是一张图。

在这里插入图片描述

现在一切都很好,但我看不到它从哪里收集数据(Yahoo API),还有一些问题,所以我将解决这些问题并在下一步进行测试。让我们看看。

第1次迭代

在这里插入图片描述

现在,我将 GPT 4o—with canvas 给我的代码粘贴到我的 local.py 中,并检查了上述结果。让我们测试一下!当我选择“AAPL”时,它首先显示上个月的价格。

在这里插入图片描述

从终端窗口中可以看到,代码根据您的选择运行。它还输出了预测结果。

在这里插入图片描述

如何学习大模型

现在社会上大模型越来越普及了,已经有很多人都想往这里面扎,但是却找不到适合的方法去学习。

作为一名资深码农,初入大模型时也吃了很多亏,踩了无数坑。现在我想把我的经验和知识分享给你们,帮助你们学习AI大模型,能够解决你们学习中的困难。

下面这些都是我当初辛苦整理和花钱购买的资料,现在我已将重要的AI大模型资料包括市面上AI大模型各大白皮书、AGI大模型系统学习路线、AI大模型视频教程、实战学习,等录播视频免费分享出来,需要的小伙伴可以扫取。

一、AGI大模型系统学习路线

很多人学习大模型的时候没有方向,东学一点西学一点,像只无头苍蝇乱撞,我下面分享的这个学习路线希望能够帮助到你们学习AI大模型。

在这里插入图片描述

二、AI大模型视频教程

在这里插入图片描述

三、AI大模型各大学习书籍

在这里插入图片描述

四、AI大模型各大场景实战案例

在这里插入图片描述

五、结束语

学习AI大模型是当前科技发展的趋势,它不仅能够为我们提供更多的机会和挑战,还能够让我们更好地理解和应用人工智能技术。通过学习AI大模型,我们可以深入了解深度学习、神经网络等核心概念,并将其应用于自然语言处理、计算机视觉、语音识别等领域。同时,掌握AI大模型还能够为我们的职业发展增添竞争力,成为未来技术领域的领导者。

再者,学习AI大模型也能为我们自己创造更多的价值,提供更多的岗位以及副业创收,让自己的生活更上一层楼。

因此,学习AI大模型是一项有前景且值得投入的时间和精力的重要选择。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值