Spaces:
Sleeping
Sleeping
LordFarquaad42
commited on
Commit
•
e4e56af
1
Parent(s):
c796de9
adding stablity patch
Browse files- app.py +19 -11
- database.py +0 -1
- params.py +1 -1
app.py
CHANGED
@@ -2,10 +2,10 @@ import streamlit as st
|
|
2 |
from openai import OpenAI
|
3 |
from params import params
|
4 |
from database import get_client
|
5 |
-
from add_data import start_troggin_off, create_client
|
6 |
|
7 |
-
#
|
8 |
-
|
|
|
9 |
APP_NAME: str = "Groove-GPT"
|
10 |
history = []
|
11 |
st.set_page_config(layout="wide")
|
@@ -13,13 +13,15 @@ st.set_page_config(layout="wide")
|
|
13 |
# INFO
|
14 |
st.title(APP_NAME)
|
15 |
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
|
22 |
-
l_col, r_col = st.columns((3, 1))
|
23 |
|
24 |
# param column
|
25 |
with r_col:
|
@@ -34,10 +36,17 @@ with r_col:
|
|
34 |
|
35 |
# input & response
|
36 |
with l_col:
|
37 |
-
user_question: str = st.text_input(
|
|
|
|
|
|
|
38 |
|
39 |
# ON BUTTON CLICK
|
40 |
-
if
|
|
|
|
|
|
|
|
|
41 |
openai_client = OpenAI(api_key=access_key)
|
42 |
|
43 |
with st.spinner("Loading..."):
|
@@ -69,7 +78,6 @@ with l_col:
|
|
69 |
content = ""
|
70 |
for i, chunk in enumerate(response):
|
71 |
if chunk.choices[0].delta.content is not None:
|
72 |
-
# Append the chunk content to the string
|
73 |
content += chunk.choices[0].delta.content
|
74 |
|
75 |
text_placeholder.markdown(content)
|
|
|
2 |
from openai import OpenAI
|
3 |
from params import params
|
4 |
from database import get_client
|
|
|
5 |
|
6 |
+
# from add_data import start_troggin_off, create_client
|
7 |
+
|
8 |
+
CLIENT = get_client()
|
9 |
APP_NAME: str = "Groove-GPT"
|
10 |
history = []
|
11 |
st.set_page_config(layout="wide")
|
|
|
13 |
# INFO
|
14 |
st.title(APP_NAME)
|
15 |
|
16 |
+
l_col, r_col = st.columns((3, 1))
|
17 |
|
18 |
+
if "trigger" not in st.session_state:
|
19 |
+
st.session_state["trigger"] = False
|
20 |
+
|
21 |
+
|
22 |
+
def on_enter():
|
23 |
+
st.session_state["trigger"] = True
|
24 |
|
|
|
25 |
|
26 |
# param column
|
27 |
with r_col:
|
|
|
36 |
|
37 |
# input & response
|
38 |
with l_col:
|
39 |
+
user_question: str = st.text_input(
|
40 |
+
"Enter your groovy questions here",
|
41 |
+
on_change=on_enter,
|
42 |
+
)
|
43 |
|
44 |
# ON BUTTON CLICK
|
45 |
+
if (
|
46 |
+
(submit_button | st.session_state["trigger"])
|
47 |
+
& (access_key != "")
|
48 |
+
& (user_question != "")
|
49 |
+
):
|
50 |
openai_client = OpenAI(api_key=access_key)
|
51 |
|
52 |
with st.spinner("Loading..."):
|
|
|
78 |
content = ""
|
79 |
for i, chunk in enumerate(response):
|
80 |
if chunk.choices[0].delta.content is not None:
|
|
|
81 |
content += chunk.choices[0].delta.content
|
82 |
|
83 |
text_placeholder.markdown(content)
|
database.py
CHANGED
@@ -2,7 +2,6 @@ import chromadb
|
|
2 |
from chromadb.utils import embedding_functions
|
3 |
|
4 |
def get_client():
|
5 |
-
# CONSTANTS
|
6 |
client = chromadb.PersistentClient(path="./chromadb_linux/")
|
7 |
MODEL_NAME: str = "mixedbread-ai/mxbai-embed-large-v1" # ~ 0.5 gb
|
8 |
COLLECTION_NAME: str = "scheme"
|
|
|
2 |
from chromadb.utils import embedding_functions
|
3 |
|
4 |
def get_client():
|
|
|
5 |
client = chromadb.PersistentClient(path="./chromadb_linux/")
|
6 |
MODEL_NAME: str = "mixedbread-ai/mxbai-embed-large-v1" # ~ 0.5 gb
|
7 |
COLLECTION_NAME: str = "scheme"
|
params.py
CHANGED
@@ -3,7 +3,7 @@ import streamlit as st
|
|
3 |
|
4 |
def params():
|
5 |
submit_button = st.button("Start Scheming")
|
6 |
-
|
7 |
# API Key
|
8 |
access_key: str = st.text_input("Enter your gpt key here", type="password")
|
9 |
st.markdown(
|
|
|
3 |
|
4 |
def params():
|
5 |
submit_button = st.button("Start Scheming")
|
6 |
+
|
7 |
# API Key
|
8 |
access_key: str = st.text_input("Enter your gpt key here", type="password")
|
9 |
st.markdown(
|