Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -4,17 +4,15 @@ from huggingface_hub import InferenceClient
|
|
| 4 |
api_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
| 5 |
|
| 6 |
client = InferenceClient(
|
| 7 |
-
model="
|
| 8 |
token=api_token
|
| 9 |
)
|
| 10 |
|
| 11 |
prompt = "Hello world"
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
response = client.
|
| 15 |
-
|
| 16 |
-
max_new_tokens=50,
|
| 17 |
-
temperature=0.7
|
| 18 |
)
|
| 19 |
|
| 20 |
-
print(response)
|
|
|
|
| 4 |
api_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
|
| 5 |
|
| 6 |
client = InferenceClient(
|
| 7 |
+
model="mistralai/Mistral-7B-Instruct-v0.2", # Example chat model
|
| 8 |
token=api_token
|
| 9 |
)
|
| 10 |
|
| 11 |
prompt = "Hello world"
|
| 12 |
|
| 13 |
+
# For chat models
|
| 14 |
+
response = client.chat_completion(
|
| 15 |
+
messages=[{"role": "user", "content": prompt}]
|
|
|
|
|
|
|
| 16 |
)
|
| 17 |
|
| 18 |
+
print(response.choices[0].message.content)
|