migrate to git.charlotte.sh
This commit is contained in:
commit
fbd588721e
412 changed files with 13750 additions and 0 deletions
17
python-csi160/ollama/ollama.py
Normal file
17
python-csi160/ollama/ollama.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# in a seperate terminal:
|
||||
# ollama run gemma2
|
||||
|
||||
import requests
|
||||
|
||||
prompt = "Why the sky is blue?"
|
||||
|
||||
data = {
|
||||
"model": "gemma2:2b",
|
||||
"prompt": prompt,
|
||||
"stream": False
|
||||
}
|
||||
|
||||
response = requests.post("http://localhost:11434/api/generate", json=data)
|
||||
json_response = response.json()
|
||||
message = json_response["response"]
|
||||
print(message)
|
Loading…
Add table
Add a link
Reference in a new issue