Spaces:
Sleeping
Sleeping
update api key flow
Browse files
app.py
CHANGED
@@ -18,11 +18,14 @@ openai_api_key = placeholder.text_input(
|
|
18 |
placeholder='Your OpenAI API Key'
|
19 |
)
|
20 |
|
21 |
-
|
22 |
-
|
|
|
23 |
placeholder.empty()
|
24 |
-
|
25 |
-
|
|
|
|
|
26 |
|
27 |
# Load data
|
28 |
loader = DirectoryLoader('./shakespeare/html/', loader_cls=lambda path: BSHTMLLoader(path, bs_kwargs={'features': 'html.parser'}))
|
|
|
18 |
placeholder='Your OpenAI API Key'
|
19 |
)
|
20 |
|
21 |
+
if openai_api_key == '':
|
22 |
+
st.stop()
|
23 |
+
else:
|
24 |
placeholder.empty()
|
25 |
+
|
26 |
+
# Load model
|
27 |
+
llm = ChatOpenAI(temperature=0, model_name='gpt-3.5-turbo', openai_api_key=openai_api_key)
|
28 |
+
embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key)
|
29 |
|
30 |
# Load data
|
31 |
loader = DirectoryLoader('./shakespeare/html/', loader_cls=lambda path: BSHTMLLoader(path, bs_kwargs={'features': 'html.parser'}))
|