-
Notifications
You must be signed in to change notification settings - Fork 4
/
Database.py
27 lines (21 loc) · 815 Bytes
/
Database.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
from build_database import create_database,query_database
import streamlit as st
from dotenv import load_dotenv
import openai
import os
from chat import get_openai_answer
load_dotenv()
openai.api_key = os.environ['OPENAI_API_KEY']
# tab1, tab2 = st.tabs(["Database","Chat"])
# with tab1:
ticker = st.text_input(label="Ticker")
quarter = st.selectbox(label="Quarter",options=["Q4","Q3","Q2","Q1"])
year = st.text_input(label="Year")
if year!="":
int_year = float(year)
if ticker!="" and quarter!="" and year!="":
qdrant_client,encoder,speakers_list = create_database(quarter=quarter,ticker=ticker,year=int_year)
st.write("Created the database")
st.session_state['qdrant_client'] = qdrant_client
st.session_state['encoder'] = encoder
st.session_state['speakers_list'] = speakers_list