Spaces:
Runtime error
Runtime error
Updated with API key call
Browse files
app.py
CHANGED
@@ -3,8 +3,8 @@ from openai import OpenAI
|
|
3 |
import os
|
4 |
import sys
|
5 |
from langchain.callbacks import StreamlitCallbackHandler
|
6 |
-
|
7 |
-
|
8 |
|
9 |
|
10 |
if 'key' not in st.session_state:
|
@@ -16,7 +16,7 @@ if 'key' not in st.session_state:
|
|
16 |
# initialize the client but point it to TGI
|
17 |
client = OpenAI(
|
18 |
base_url="https://api-inference.huggingface.co/v1",
|
19 |
-
|
20 |
)
|
21 |
|
22 |
|
|
|
3 |
import os
|
4 |
import sys
|
5 |
from langchain.callbacks import StreamlitCallbackHandler
|
6 |
+
from dotenv import load_dotenv, dotenv_values
|
7 |
+
load_dotenv()
|
8 |
|
9 |
|
10 |
if 'key' not in st.session_state:
|
|
|
16 |
# initialize the client but point it to TGI
|
17 |
client = OpenAI(
|
18 |
base_url="https://api-inference.huggingface.co/v1",
|
19 |
+
api_key=os.environ.get('HUGGINGFACEHUB_API_TOKEN')#"hf_xxx" # Replace with your token
|
20 |
)
|
21 |
|
22 |
|