Spaces:
Running
Running
Daniel Szpisjak
commited on
Commit
·
c2ba39e
1
Parent(s):
e96c3cb
use openai client
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from
|
|
|
|
| 3 |
import os
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
|
|
@@ -10,12 +11,9 @@ token = os.environ.get("HF_TOKEN")
|
|
| 10 |
if not token:
|
| 11 |
raise gr.Error("HF_TOKEN is not set.")
|
| 12 |
|
| 13 |
-
|
| 14 |
-
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
|
| 15 |
-
"""
|
| 16 |
-
client = InferenceClient(
|
| 17 |
base_url="https://mw6ztcar07ths6bp.us-east-1.aws.endpoints.huggingface.cloud/v1/",
|
| 18 |
-
|
| 19 |
)
|
| 20 |
|
| 21 |
def respond(
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from openai import OpenAI
|
| 3 |
+
|
| 4 |
import os
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
|
|
|
|
| 11 |
if not token:
|
| 12 |
raise gr.Error("HF_TOKEN is not set.")
|
| 13 |
|
| 14 |
+
client = OpenAI(
|
|
|
|
|
|
|
|
|
|
| 15 |
base_url="https://mw6ztcar07ths6bp.us-east-1.aws.endpoints.huggingface.cloud/v1/",
|
| 16 |
+
api_key=token
|
| 17 |
)
|
| 18 |
|
| 19 |
def respond(
|