Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,7 @@ import subprocess
|
|
| 5 |
import spaces
|
| 6 |
|
| 7 |
OLLAMA = os.path.expanduser("~/ollama")
|
|
|
|
| 8 |
|
| 9 |
if not os.path.exists(OLLAMA):
|
| 10 |
subprocess.run("curl -L https://ollama.com/download/ollama-linux-amd64 -o ~/ollama", shell=True)
|
|
@@ -19,6 +20,7 @@ OLLAMA_SERVICE_THREAD = threading.Thread(target=ollama_service_thread)
|
|
| 19 |
# OLLAMA_SERVICE_THREAD.start()
|
| 20 |
|
| 21 |
def terminate():
|
|
|
|
| 22 |
if process:
|
| 23 |
os.killpg(os.getpgid(process.pid), signal.SIGTERM)
|
| 24 |
OLLAMA_SERVICE_THREAD.join()
|
|
|
|
| 5 |
import spaces
|
| 6 |
|
| 7 |
OLLAMA = os.path.expanduser("~/ollama")
|
| 8 |
+
process = ""
|
| 9 |
|
| 10 |
if not os.path.exists(OLLAMA):
|
| 11 |
subprocess.run("curl -L https://ollama.com/download/ollama-linux-amd64 -o ~/ollama", shell=True)
|
|
|
|
| 20 |
# OLLAMA_SERVICE_THREAD.start()
|
| 21 |
|
| 22 |
def terminate():
|
| 23 |
+
global process
|
| 24 |
if process:
|
| 25 |
os.killpg(os.getpgid(process.pid), signal.SIGTERM)
|
| 26 |
OLLAMA_SERVICE_THREAD.join()
|