Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,23 @@
|
|
| 1 |
import os
|
| 2 |
-
from smolagents import GradioUI, CodeAgent, InferenceClientModel
|
| 3 |
from huggingface_hub import login
|
|
|
|
| 4 |
|
| 5 |
# Load the API key
|
| 6 |
api_key = os.getenv('WingTokenAll')
|
| 7 |
|
| 8 |
# Log in using the API key
|
| 9 |
login(api_key)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
|
|
|
| 2 |
from huggingface_hub import login
|
| 3 |
+
from smolagents import InferenceClientModel
|
| 4 |
|
| 5 |
# Load the API key
|
| 6 |
api_key = os.getenv('WingTokenAll')
|
| 7 |
|
| 8 |
# Log in using the API key
|
| 9 |
login(api_key)
|
| 10 |
+
|
| 11 |
+
# Test model access
|
| 12 |
+
model = InferenceClientModel(
|
| 13 |
+
model='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 14 |
+
model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
|
| 15 |
+
provider='auto' # Use 'auto' or a valid provider
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
# Attempt to generate a response (adjust parameters as needed)
|
| 19 |
+
try:
|
| 20 |
+
response = model.chat_completion(inputs="Hello, how can I help you?")
|
| 21 |
+
print(response)
|
| 22 |
+
except Exception as e:
|
| 23 |
+
print(f"Error: {e}")
|