Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,23 @@
|
|
| 1 |
-
"""
|
|
|
|
|
|
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
ACCESS_TOKEN = os.getenv("HF_TOKEN")
|
| 7 |
|
|
|
|
| 8 |
client = OpenAI(
|
| 9 |
base_url="https://api-inference.huggingface.co/v1/",
|
| 10 |
api_key=ACCESS_TOKEN,
|
| 11 |
)
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def respond(
|
| 14 |
message,
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
cf https://huggingface.co/spaces/Nymbo/Qwen-2.5-72B-Instruct/blob/main/app.py
|
| 3 |
+
https://github.com/huggingface/huggingface-llama-recipes/blob/main/api_inference/inference-api.ipynb
|
| 4 |
+
"""
|
| 5 |
import gradio as gr
|
| 6 |
+
|
| 7 |
+
# from openai import OpenAI
|
| 8 |
+
from huggingface_hub import InferenceClient
|
| 9 |
+
|
| 10 |
import os
|
| 11 |
|
| 12 |
ACCESS_TOKEN = os.getenv("HF_TOKEN")
|
| 13 |
|
| 14 |
+
_ = """
|
| 15 |
client = OpenAI(
|
| 16 |
base_url="https://api-inference.huggingface.co/v1/",
|
| 17 |
api_key=ACCESS_TOKEN,
|
| 18 |
)
|
| 19 |
+
# """
|
| 20 |
+
client = InferenceClient()
|
| 21 |
|
| 22 |
def respond(
|
| 23 |
message,
|