ka1kuk commited on
Commit
745face
1 Parent(s): b5787d7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -13
main.py CHANGED
@@ -1,16 +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
-
12
- # Start Ollama server
13
- run_command("ollama serve")
14
 
15
- if __name__ == "__main__":
16
- 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)