-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
57 lines (44 loc) · 2.11 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
49
50
51
52
53
54
55
56
57
import streamlit as st
from types import SimpleNamespace
def init_app():
st.set_page_config(page_title="VoiceMyNote", page_icon="🗒️")
st.title("VoiceMyNote 🗣️🗒️")
if "api_keys" not in st.session_state:
st.session_state["api_keys"] = SimpleNamespace(
openai_api_key="",
assemblyai_api_key="",
weaviate_url="",
weaviate_api_key="",
unsplash_access_key=""
)
with st.expander("api key configuration", expanded=True):
openai_api_key = st.text_input("OpenAI key", type="password",
value=st.session_state.api_keys.openai_api_key)
assemblyai_api_key = st.text_input("AssemblyAI key", type="password",
value=st.session_state.api_keys.assemblyai_api_key)
# weaviate_url = st.text_input("Weaviate URL", type="default",
# value=st.session_state.api_keys.weaviate_url)
# weaviate_api_key = st.text_input("Weaviate api_key", type="password",
# value=st.session_state.api_keys.weaviate_api_key)
# unsplash_api_key = st.text_input("Unsplash API Key", type="password",
# value=st.session_state.api_keys.unsplash_api_key)
if openai_api_key:
st.session_state.api_keys.openai_api_key = openai_api_key
if assemblyai_api_key:
st.session_state.api_keys.assemblyai_api_key = assemblyai_api_key
if not st.session_state.api_keys.openai_api_key:
st.error("open ai is mandatory")
st.stop()
# if weaviate_url:
# st.session_state.api_keys.weaviate_url = weaviate_url
# if weaviate_api_key:
# st.session_state.api_keys.weaviate_api_key = weaviate_api_key
# if unsplash_api_key:
# st.session_state.api_keys.unsplash_api_key = unsplash_api_key
init_app()
@st.cache_data
def get_readme():
with open("./README.md") as f:
readme = f.read()
return readme
st.markdown(body=get_readme())