Spaces:
Sleeping
Sleeping
Commit
·
f41839a
1
Parent(s):
3265843
fixes
Browse files- .gitignore +1 -0
- app.py +13 -1
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
.env
|
app.py
CHANGED
@@ -1,10 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
|
|
3 |
|
4 |
"""
|
5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
6 |
"""
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
|
10 |
def respond(
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
+
import os
|
4 |
|
5 |
"""
|
6 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
7 |
"""
|
8 |
+
# You need to provide an API token to access your private model
|
9 |
+
# Get your token from: https://huggingface.co/settings/tokens
|
10 |
+
HF_TOKEN = os.environ.get("HF_TOKEN") # You should set this as an environment variable
|
11 |
+
if not HF_TOKEN:
|
12 |
+
print("Warning: No Hugging Face token found in environment variables.")
|
13 |
+
print("Please set your HF_TOKEN environment variable or add it directly in the code.")
|
14 |
+
print("Get your token from: https://huggingface.co/settings/tokens")
|
15 |
+
|
16 |
+
client = InferenceClient(
|
17 |
+
"Trinoid/Data_Management_Mistral",
|
18 |
+
token=HF_TOKEN
|
19 |
+
)
|
20 |
|
21 |
|
22 |
def respond(
|