Spaces:
Sleeping
Sleeping
Commit
·
5ab8b76
1
Parent(s):
48826bd
test
Browse files
app.py
CHANGED
@@ -23,7 +23,8 @@ from dotenv import load_dotenv
|
|
23 |
from huggingface_hub import InferenceApi
|
24 |
|
25 |
#zero = torch.Tensor([0]).cuda()
|
26 |
-
|
|
|
27 |
#@spaces.GPU
|
28 |
def read_pdf(file_path):
|
29 |
output = ''
|
@@ -51,7 +52,7 @@ def read_pdf(file_path):
|
|
51 |
# Function to query Hugging Face endpoint
|
52 |
#@spaces.GPU
|
53 |
def query_huggingface(text):
|
54 |
-
api = InferenceApi(repo_id="google/gemma-2-9b-it", token=
|
55 |
response = api(inputs=text)
|
56 |
return response
|
57 |
|
|
|
23 |
from huggingface_hub import InferenceApi
|
24 |
|
25 |
#zero = torch.Tensor([0]).cuda()
|
26 |
+
load_dotenv()
|
27 |
+
api_token = os.getenv("HF_TOKEN")
|
28 |
#@spaces.GPU
|
29 |
def read_pdf(file_path):
|
30 |
output = ''
|
|
|
52 |
# Function to query Hugging Face endpoint
|
53 |
#@spaces.GPU
|
54 |
def query_huggingface(text):
|
55 |
+
api = InferenceApi(repo_id="google/gemma-2-9b-it", token=api_token)
|
56 |
response = api(inputs=text)
|
57 |
return response
|
58 |
|