Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,18 @@
|
|
| 1 |
-
import
|
|
|
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
model: "moonshotai/Kimi-K2-Instruct-0905",
|
| 9 |
-
messages: [
|
| 10 |
{
|
| 11 |
-
role: "user",
|
| 12 |
-
content: "What is the capital of France?"
|
| 13 |
-
}
|
| 14 |
],
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
if (chunk.choices && chunk.choices.length > 0) {
|
| 19 |
-
const newContent = chunk.choices[0].delta.content;
|
| 20 |
-
out += newContent;
|
| 21 |
-
console.log(newContent);
|
| 22 |
-
}
|
| 23 |
-
}
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
|
| 4 |
+
client = InferenceClient(
|
| 5 |
+
api_key=os.environ["HF_TOKEN"],
|
| 6 |
+
)
|
| 7 |
|
| 8 |
+
completion = client.chat.completions.create(
|
| 9 |
+
model="moonshotai/Kimi-K2-Instruct-0905:groq",
|
| 10 |
+
messages=[
|
|
|
|
|
|
|
| 11 |
{
|
| 12 |
+
"role": "user",
|
| 13 |
+
"content": "What is the capital of France?"
|
| 14 |
+
}
|
| 15 |
],
|
| 16 |
+
)
|
| 17 |
|
| 18 |
+
print(completion.choices[0].message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|