Skip to content

Instantly share code, notes, and snippets.

@se7enack
Created June 11, 2024 12:33
Show Gist options
  • Save se7enack/049a10bb8a7f9f837d16bb0b3c15a287 to your computer and use it in GitHub Desktop.
Save se7enack/049a10bb8a7f9f837d16bb0b3c15a287 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import requests, json
jsn = {"model": "llama3","prompt": "hi","stream": False}
response = requests.post('http://localhost:11434/api/generate', json=jsn)
if response.status_code != 200:
print(response.status_code)
exit(1)
else:
try:
print(response.json()['response'])
except:
print(response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment