mca183 commited on
Commit
4ccd956
1 Parent(s): 65a9c81

adding hf auth token

Browse files
Files changed (2) hide show
  1. app.py +5 -1
  2. requirements.txt +2 -1
app.py CHANGED
@@ -5,10 +5,14 @@ from langchain.text_splitter import RecursiveCharacterTextSplitter
5
 
6
  from transformers import AutoTokenizer, pipeline
7
  import gradio as gr
 
 
8
 
 
 
9
 
10
  # Load the data
11
- loader = HuggingFaceDatasetLoader("databricks/databricks-dolly-15k", "context")
12
  data = loader.load()
13
 
14
  # Document Transformers
 
5
 
6
  from transformers import AutoTokenizer, pipeline
7
  import gradio as gr
8
+ import os
9
+ from dotenv import load_dotenv, find_dotenv
10
 
11
+ _ = load_dotenv(find_dotenv()) # read local .env file
12
+ hf_api_key = os.environ['HF_TOKEN']
13
 
14
  # Load the data
15
+ loader = HuggingFaceDatasetLoader(path="databricks/databricks-dolly-15k", page_content_column="context", use_auth_token=hf_api_key)
16
  data = loader.load()
17
 
18
  # Document Transformers
requirements.txt CHANGED
@@ -5,4 +5,5 @@ transformers[torch]
5
  sentence-transformers
6
  datasets
7
  faiss-cpu
8
- gradio
 
 
5
  sentence-transformers
6
  datasets
7
  faiss-cpu
8
+ gradio
9
+ python-dotenv