Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,12 +40,23 @@ def install_packages():
|
|
| 40 |
# Install llama-cpp-agent
|
| 41 |
run_command("pip install llama-cpp-agent")
|
| 42 |
|
|
|
|
|
|
|
| 43 |
print("Installation complete!")
|
| 44 |
|
| 45 |
try:
|
| 46 |
install_packages()
|
| 47 |
|
| 48 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
from llama_cpp import Llama
|
| 50 |
from llama_cpp_agent import LlamaCppAgent, MessagesFormatterType
|
| 51 |
from llama_cpp_agent.providers import LlamaCppPythonProvider
|
|
|
|
| 40 |
# Install llama-cpp-agent
|
| 41 |
run_command("pip install llama-cpp-agent")
|
| 42 |
|
| 43 |
+
run_command("export PYTHONPATH=$PYTHONPATH:$(pwd)")
|
| 44 |
+
|
| 45 |
print("Installation complete!")
|
| 46 |
|
| 47 |
try:
|
| 48 |
install_packages()
|
| 49 |
|
| 50 |
+
# Add a delay to allow for package registration
|
| 51 |
+
import time
|
| 52 |
+
time.sleep(5)
|
| 53 |
+
|
| 54 |
+
# Force Python to reload the site packages
|
| 55 |
+
import site
|
| 56 |
+
import importlib
|
| 57 |
+
importlib.reload(site)
|
| 58 |
+
|
| 59 |
+
# Now try to import the libraries
|
| 60 |
from llama_cpp import Llama
|
| 61 |
from llama_cpp_agent import LlamaCppAgent, MessagesFormatterType
|
| 62 |
from llama_cpp_agent.providers import LlamaCppPythonProvider
|