JPMorgan / app.py
adejumobi's picture
Create app.py
dd13923
raw
history blame
3.24 kB
import openai
model = "gpt-3.5-turbo"
def morgan(text):
# Create a prompt that includes the question, investment options, financial advice, and money range
prompt = f"""
Consider the following financial questions and answers examples that student can ask:
Question: What is the ideal investment option when considering FGN Savings Bond (FGNSB)?
Answer: The ideal investment option when considering FGN Savings Bond (FGNSB) is to approach your stockbroker. Minimum investment is N5,000.
Question: How can I start investing with Mutual Funds?
Answer: You can start investing with Mutual Funds by considering them as they are best suited for people who do not have deep knowledge of the sophisticated financial market or those who do not have the time to analyze the market by themselves. As little as N5,000 is needed.
Question: What are the options for Online Investment Apps, and how can I start investing with them?
Answer: The options for Online Investment Apps include I-Invest, Piggy Bank, Payday Investor, and PayVest. To start investing with them, consider using these apps to start investing with small amounts of money. The rate of interest you earn by using these apps can be as high as 20 percent per annum.
Question: What is the ideal way to invest in Online Agric Investment Portals, and what is the expected return?
Answer: The ideal way to invest in Online Agric Investment Portals is to consider popular options like Farmcrowdy. You can sponsor different farm projects of your choice for a guaranteed return of up to 50 percent per farming cycle. The amount range varies by project.
Question: How should I approach Money Market Instruments for investment, and what is the minimum investment required?
Answer: For Money Market Instruments, consider investing in money market funds. They are easily affordable by small investors and often provide returns above inflation rates. The minimum investment is N5,000.
Question: What is the minimum investment required to start investing in Stocks, and what are the ways to earn from them?
Answer: The minimum investment required to start investing in Stocks is variable and varies by stock. Ways to earn from stocks include capital appreciation, cash dividend, and bonus issues. These are additional shares that shareholders get for free.
Taking the role of a financial advisor, provide guidance to students in Nigeria on investment problems based on the question asked below:
Question: {text}
"""
def get_response(prompt, model):
conversation = [
{"role": "user", "content": prompt}
]
response = openai.ChatCompletion.create(
model=model,
messages=conversation,
temperature=0, # Adjust the temperature as desired
)
return response.choices[0].message["content"]
response = get_response(prompt, model)
return response
if __name__ == "__main__":
# make a gradio interface
import gradio as gr
outputs = gr.outputs.Textbox()
app = gr.Interface(fn=morgan, inputs='text', outputs=outputs,description="This is an investment financial advisor for students in Nigeria").launch()