Spaces:
Sleeping
Sleeping
Update app.py
Browse filesinstall joblib
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
!pip install joblib
|
| 2 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 3 |
import datetime
|
| 4 |
import requests
|
|
@@ -13,6 +12,23 @@ import joblib
|
|
| 13 |
from sklearn.ensemble import RandomForestClassifier
|
| 14 |
from sklearn.preprocessing import LabelEncoder
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
os.getenv("HF_TOKEN")
|
| 17 |
|
| 18 |
@tool
|
|
|
|
|
|
|
| 1 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
|
|
|
| 12 |
from sklearn.ensemble import RandomForestClassifier
|
| 13 |
from sklearn.preprocessing import LabelEncoder
|
| 14 |
|
| 15 |
+
import subprocess
|
| 16 |
+
import sys
|
| 17 |
+
|
| 18 |
+
def install(package):
|
| 19 |
+
# Use pip to install the package
|
| 20 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
|
| 21 |
+
|
| 22 |
+
# Install joblib
|
| 23 |
+
install("joblib")
|
| 24 |
+
|
| 25 |
+
# Verify installation
|
| 26 |
+
try:
|
| 27 |
+
import joblib
|
| 28 |
+
print(f"Successfully installed joblib version {joblib.__version__}")
|
| 29 |
+
except ImportError:
|
| 30 |
+
print("Failed to install joblib.")
|
| 31 |
+
|
| 32 |
os.getenv("HF_TOKEN")
|
| 33 |
|
| 34 |
@tool
|