Commit
Β·
5580b5a
1
Parent(s):
2014213
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,10 +14,10 @@ class LLM_Langchain():
|
|
| 14 |
st.text("Made with Langchain, StreamLit, Hugging Face and π")
|
| 15 |
st.header('π¦π One stop for Open Source Models')
|
| 16 |
|
| 17 |
-
self.API_KEY = st.sidebar.text_input(
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
self.task_name = st.sidebar.selectbox(
|
| 23 |
label = "Choose the task you want to perform",
|
|
@@ -73,10 +73,11 @@ class LLM_Langchain():
|
|
| 73 |
|
| 74 |
self.model_kwargs = {
|
| 75 |
"temperature": self.temperature,
|
| 76 |
-
"
|
| 77 |
}
|
| 78 |
|
| 79 |
-
os.environ['HUGGINGFACEHUB_API_TOKEN'] = self.API_KEY
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
def generate_response(self, input_text):
|
|
@@ -121,8 +122,8 @@ class LLM_Langchain():
|
|
| 121 |
def form_data(self):
|
| 122 |
# with st.form('my_form'):
|
| 123 |
try:
|
| 124 |
-
if not self.API_KEY.startswith('hf_'):
|
| 125 |
-
|
| 126 |
|
| 127 |
self.selected_option = self.radio_button()
|
| 128 |
self.pdf_uploader()
|
|
|
|
| 14 |
st.text("Made with Langchain, StreamLit, Hugging Face and π")
|
| 15 |
st.header('π¦π One stop for Open Source Models')
|
| 16 |
|
| 17 |
+
# self.API_KEY = st.sidebar.text_input(
|
| 18 |
+
# 'API Key',
|
| 19 |
+
# type='password',
|
| 20 |
+
# help="Type in your HuggingFace API key to use this app")
|
| 21 |
|
| 22 |
self.task_name = st.sidebar.selectbox(
|
| 23 |
label = "Choose the task you want to perform",
|
|
|
|
| 73 |
|
| 74 |
self.model_kwargs = {
|
| 75 |
"temperature": self.temperature,
|
| 76 |
+
"max_new_tokens": self.max_token_length
|
| 77 |
}
|
| 78 |
|
| 79 |
+
# os.environ['HUGGINGFACEHUB_API_TOKEN'] = self.API_KEY
|
| 80 |
+
os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.getenv("HF_KEY")
|
| 81 |
|
| 82 |
|
| 83 |
def generate_response(self, input_text):
|
|
|
|
| 122 |
def form_data(self):
|
| 123 |
# with st.form('my_form'):
|
| 124 |
try:
|
| 125 |
+
# if not self.API_KEY.startswith('hf_'):
|
| 126 |
+
# st.warning('Please enter your API key!', icon='β ')
|
| 127 |
|
| 128 |
self.selected_option = self.radio_button()
|
| 129 |
self.pdf_uploader()
|