add hub login
Browse files- requirements.txt +2 -1
- src/few_shot_funcs.py +4 -1
requirements.txt
CHANGED
@@ -2,4 +2,5 @@ bs4==0.0.1
|
|
2 |
inflect==7.0.0
|
3 |
openai==0.27.7
|
4 |
pandas==1.5.3
|
5 |
-
langchain==0.0.327
|
|
|
|
2 |
inflect==7.0.0
|
3 |
openai==0.27.7
|
4 |
pandas==1.5.3
|
5 |
+
langchain==0.0.327
|
6 |
+
huggingface-hub==0.16.4
|
src/few_shot_funcs.py
CHANGED
@@ -5,12 +5,15 @@ import inflect
|
|
5 |
import pandas as pd
|
6 |
from typing import Dict
|
7 |
from datasets import load_dataset
|
|
|
8 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
9 |
from langchain.vectorstores import FAISS
|
10 |
from langchain.vectorstores.utils import DistanceStrategy
|
11 |
|
12 |
|
|
|
13 |
openai.api_key = os.environ.get('OPENAI_KEY')
|
|
|
14 |
|
15 |
|
16 |
# Constants
|
@@ -18,7 +21,7 @@ FS_COLUMNS = ['asin', 'category', 'title', 'tech_process', 'labels']
|
|
18 |
MAX_TOKENS = 700
|
19 |
USER_TXT = 'Write feature-bullets for an Amazon product page. ' \
|
20 |
'Title: {title}. Technical details: {tech_data}.\n\n### Feature-bullets:'
|
21 |
-
|
22 |
# Load few-shot dataset
|
23 |
FS_DATASET = load_dataset('iarbel/amazon-product-data-filter', split='validation')
|
24 |
|
|
|
5 |
import pandas as pd
|
6 |
from typing import Dict
|
7 |
from datasets import load_dataset
|
8 |
+
from huggingface_hub import login
|
9 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
10 |
from langchain.vectorstores import FAISS
|
11 |
from langchain.vectorstores.utils import DistanceStrategy
|
12 |
|
13 |
|
14 |
+
# Get OpenAI and huggingface-hub keys
|
15 |
openai.api_key = os.environ.get('OPENAI_KEY')
|
16 |
+
login(os.environ.get('HUB_KEY'))
|
17 |
|
18 |
|
19 |
# Constants
|
|
|
21 |
MAX_TOKENS = 700
|
22 |
USER_TXT = 'Write feature-bullets for an Amazon product page. ' \
|
23 |
'Title: {title}. Technical details: {tech_data}.\n\n### Feature-bullets:'
|
24 |
+
|
25 |
# Load few-shot dataset
|
26 |
FS_DATASET = load_dataset('iarbel/amazon-product-data-filter', split='validation')
|
27 |
|