-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
48 lines (37 loc) · 1.39 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from flask import Flask, render_template, request
import google.generativeai as genai
import os
import textblob
# Configure API key
api = os.getenv("MAKERSUITE_API_TOKEN")
genai.configure(api_key=api)
# Load the model
model = genai.GenerativeModel("gemini-1.5-flash")
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def index():
return render_template("index.html")
@app.route("/financial_QA", methods=["GET", "POST"])
def financial_QA():
return render_template("financial_QA.html")
@app.route("/financial_news", methods=["GET", "POST"])
def financial_news():
return render_template("financial_news.html")
@app.route("/makersuite", methods=["GET", "POST"])
def makersuite():
q = request.form.get("q")
r = model.generate_content(q)
return render_template("makersuite.html", r=r.text)
@app.route("/sentiment_analysis", methods=["GET", "POST"])
def sentiment_analysis():
return render_template("sentiment_analysis.html")
@app.route("/transfer_money", methods=["GET", "POST"])
def transfer_money():
return render_template("transfer_money.html")
@app.route("/sentiment_analysis_result", methods=["GET", "POST"])
def sentiment_analysis_result():
q = request.form.get("q")
r = textblob.TextBlob(q).sentiment
return render_template("sentiment_analysis_result.html", r=r)
if __name__ == "__main__":
app.run()