russkiyximik commited on
Commit
7e04af3
·
1 Parent(s): 1a35a7a

trying to launch ollama

Browse files
Files changed (2) hide show
  1. mycoder/app.py +8 -1
  2. mycoder/ollamaini.py +13 -0
mycoder/app.py CHANGED
@@ -33,4 +33,11 @@ if st.button("Run Query2Plot"):
33
 
34
  # TO DO: Display the generated plot if it exists
35
  if os.path.exists("output/plot.png"):
36
- st.image("output/plot.png", caption="Generated Figure")
 
 
 
 
 
 
 
 
33
 
34
  # TO DO: Display the generated plot if it exists
35
  if os.path.exists("output/plot.png"):
36
+ st.image("output/plot.png", caption="Generated Figure")
37
+
38
+ if st.button("DEMO START OLLAMA"):
39
+ from mycoder.ollamaini import start_ollama, start_model
40
+ start_ollama()
41
+ import time
42
+ time.sleep(20) # Wait for Ollama to start
43
+ start_model()
mycoder/ollamaini.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+
3
+ def download_ollama() -> None:
4
+ subprocess.run(["curl -fsSL https://ollama.com/install.sh | sh"], shell=True, check=True)
5
+
6
+ def start_ollama() -> None:
7
+ subprocess.run(["ollama", "serve", "&"], shell=True, check=True)
8
+
9
+ def start_model() -> None:
10
+ subprocess.run(["ollama", "run", "codellama:7b"], check=True)
11
+
12
+ def stop_model() -> None:
13
+ subprocess.run(["ollama", "stop", "codellama:7b"], check=True)