theotherdylan commited on
Commit
887a802
·
1 Parent(s): 75ada15

download ollama

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -2,13 +2,25 @@ import subprocess
2
  #from transformers import pipeline
3
  import ollama
4
  import gradio
 
 
 
 
 
 
5
 
6
 
7
- subprocess.run("curl -fsSL https://ollama.com/install.sh | sh", shell=True)
8
 
9
  history = []
10
 
11
 
 
 
 
 
 
 
 
12
  def get_history_messages():
13
  messages = []
14
  for user, assist in history:
 
2
  #from transformers import pipeline
3
  import ollama
4
  import gradio
5
+ import os
6
+ import threading
7
+
8
+
9
+ if not os.path.exists(os.path.expanduser("~/ollama")):
10
+ subprocess.run("curl -L https://ollama.com/download/ollama-linux-amd64 -o ~/ollama", shell=True)
11
 
12
 
 
13
 
14
  history = []
15
 
16
 
17
+ def ollama_service_thread():
18
+ subprocess.run("~/ollama serve", shell=True)
19
+
20
+ OLLAMA_SERVICE_THREAD = Thread(target=ollama_service_thread)
21
+ OLLAMA_SERVICE_THREAD.start()
22
+
23
+
24
  def get_history_messages():
25
  messages = []
26
  for user, assist in history: