Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -1,11 +1,14 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
-
from
|
| 4 |
|
| 5 |
-
client =
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def chat(message, history):
|
| 8 |
-
response = client.
|
| 9 |
model="HuggingFaceH4/zephyr-7b-beta",
|
| 10 |
messages=[{"role": "user", "content": message}],
|
| 11 |
max_tokens=256
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
+
from openai import OpenAI
|
| 4 |
|
| 5 |
+
client = OpenAI(
|
| 6 |
+
base_url="https://router.huggingface.co/v1",
|
| 7 |
+
api_key=os.getenv("HF_TOKEN")
|
| 8 |
+
)
|
| 9 |
|
| 10 |
def chat(message, history):
|
| 11 |
+
response = client.chat.completions.create(
|
| 12 |
model="HuggingFaceH4/zephyr-7b-beta",
|
| 13 |
messages=[{"role": "user", "content": message}],
|
| 14 |
max_tokens=256
|