File size: 629 Bytes
c1c5206 4ade382 06bbd1d c1c5206 06bbd1d c1c5206 b216cb2 c1c5206 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import requests
import json
import subprocess
def run_command(command):
try:
result = subprocess.run(command, shell=True, check=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(f"Success: {result.stdout}")
except subprocess.CalledProcessError as e:
print(f"Error: {e.stderr}")
run_command("ollama serve")
reqUrl = "http://localhost:11434/api/pull"
headersList = {
"Accept": "*/*",
"Content-Type": "application/json"
}
payload = json.dumps({
"name": "gemma:7b"
})
response = requests.request("POST", reqUrl, data=payload, headers=headersList)
print(response.text) |