mirror of
https://github.com/ollama/ollama-python.git
synced 2026-05-02 12:18:18 +08:00
create example
This commit is contained in:
parent
cdec2ad99e
commit
c74dd5835d
20
examples/create/main.py
Normal file
20
examples/create/main.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
from ollama import create
|
||||||
|
|
||||||
|
|
||||||
|
args = sys.argv[1:]
|
||||||
|
if len(args) == 2:
|
||||||
|
# create from local file
|
||||||
|
path = args[1]
|
||||||
|
else:
|
||||||
|
print('usage: python main.py <name> <filepath>')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# TODO: update to real Modelfile values
|
||||||
|
modelfile = f"""
|
||||||
|
FROM {path}
|
||||||
|
"""
|
||||||
|
|
||||||
|
for response in create(model=args[0], modelfile=modelfile, stream=True):
|
||||||
|
print(response['status'])
|
||||||
Loading…
Reference in New Issue
Block a user