Spaces:
No application file
No application file
Commit
·
d435341
1
Parent(s):
80d2596
Provide a local AI using deepseek model
Browse files- README.md +1 -1
- app.py +11 -1
- requirements.txt +3 -1
README.md
CHANGED
@@ -11,4 +11,4 @@ license: apache-2.0
|
|
11 |
short_description: Testing for e-commerce
|
12 |
---
|
13 |
|
14 |
-
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.
|
|
|
11 |
short_description: Testing for e-commerce
|
12 |
---
|
13 |
|
14 |
+
An example chatbot using [Gradio](https://gradio.app), [`huggingface_hub`](https://huggingface.co/docs/huggingface_hub/v0.25.2/en/index), and the [Hugging Face Inference API](https://huggingface.co/docs/api-inference/index).
|
app.py
CHANGED
@@ -1,10 +1,20 @@
|
|
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 |
+
from huggingface_hub.utils import HfHubHTTPError
|
4 |
+
import os
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
|
7 |
+
# Load environment variables from .env file
|
8 |
+
load_dotenv()
|
9 |
|
10 |
"""
|
11 |
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
|
12 |
"""
|
13 |
+
api_token = os.getenv("HUGGINGFACE_API_TOKEN")
|
14 |
+
if not api_token:
|
15 |
+
raise ValueError("HUGGINGFACE_API_TOKEN environment variable not set")
|
16 |
+
|
17 |
+
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token=api_token)
|
18 |
|
19 |
|
20 |
def respond(
|
requirements.txt
CHANGED
@@ -1 +1,3 @@
|
|
1 |
-
huggingface_hub==0.25.2
|
|
|
|
|
|
1 |
+
huggingface_hub==0.25.2
|
2 |
+
requests==2.31.0
|
3 |
+
python-dotenv==1.0.0
|