Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from openai import OpenAI
|
| 3 |
import requests
|
| 4 |
import huggingface_hub
|
| 5 |
|
| 6 |
# Initialize the client, pointing it to one of the available models
|
| 7 |
-
client =
|
| 8 |
-
base_url="https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1/v1/",
|
| 9 |
-
api_key=huggingface_hub.get_token(),
|
| 10 |
-
)
|
| 11 |
|
| 12 |
|
| 13 |
PROMPT = """
|
|
@@ -35,8 +31,7 @@ def generate(spaces):
|
|
| 35 |
|
| 36 |
input = PROMPT + f"```py{app_py}```"
|
| 37 |
|
| 38 |
-
chat_completion = client.
|
| 39 |
-
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 40 |
messages=[
|
| 41 |
{"role": "user", "content": input},
|
| 42 |
],
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import requests
|
| 3 |
import huggingface_hub
|
| 4 |
|
| 5 |
# Initialize the client, pointing it to one of the available models
|
| 6 |
+
client = huggingface_hub.InferenceClient(model="mistralai/Mixtral-8x7B-Instruct-v0.1")
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
PROMPT = """
|
|
|
|
| 31 |
|
| 32 |
input = PROMPT + f"```py{app_py}```"
|
| 33 |
|
| 34 |
+
chat_completion = client.chat_completion(
|
|
|
|
| 35 |
messages=[
|
| 36 |
{"role": "user", "content": input},
|
| 37 |
],
|