ka1kuk commited on
Commit
c1c5206
1 Parent(s): 98e5ec7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -15
main.py CHANGED
@@ -1,18 +1,17 @@
1
- import subprocess
 
2
 
3
- def run_command(command):
4
- try:
5
- result = subprocess.run(command, shell=True, check=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
6
- print(f"Success: {result.stdout}")
7
- except subprocess.CalledProcessError as e:
8
- print(f"Error: {e.stderr}")
9
 
10
- def main():
11
- # Install script
12
- run_command("curl -fsSL https://ollama.com/install.sh | sh")
13
-
14
- # Start Ollama server
15
- run_command("ollama serve")
16
 
17
- if __name__ == "__main__":
18
- main()
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
 
4
+ reqUrl = "http://localhost:11434/api/pull"
 
 
 
 
 
5
 
6
+ headersList = {
7
+ "Accept": "*/*",
8
+ "Content-Type": "application/json"
9
+ }
 
 
10
 
11
+ payload = json.dumps({
12
+ "name": "gemma:7b"
13
+ })
14
+
15
+ response = requests.request("POST", reqUrl, data=payload, headers=headersList)
16
+
17
+ print(response.text)