Spaces:
Running
Running
regraded01
commited on
Commit
•
2062332
1
Parent(s):
f15fdf1
feat: use env vars to store hf token
Browse files
app.py
CHANGED
@@ -2,13 +2,14 @@ import streamlit as st
|
|
2 |
import yaml
|
3 |
import requests
|
4 |
import re
|
|
|
5 |
from pdfParser import get_pdf_text
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
|
13 |
with open("config/model_config.yml", "r") as file:
|
14 |
model_config = yaml.safe_load(file)
|
|
|
2 |
import yaml
|
3 |
import requests
|
4 |
import re
|
5 |
+
import os
|
6 |
from pdfParser import get_pdf_text
|
7 |
|
8 |
+
# Get HuggingFace API key
|
9 |
+
api_key_name = "HUGGINGFACE_HUB_TOKEN"
|
10 |
+
api_key = os.getenv(api_key_name)
|
11 |
+
if api_key is None:
|
12 |
+
st.error(f"Failed to read `{api_key_name}`. Ensure the token is correctly located")
|
13 |
|
14 |
with open("config/model_config.yml", "r") as file:
|
15 |
model_config = yaml.safe_load(file)
|