Skip to content

Commit eee32dd

Browse files
authored
Merge pull request #52 from ollama/mxyng/create-example
create example
2 parents cdec2ad + c74dd58 commit eee32dd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

examples/create/main.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
3+
from ollama import create
4+
5+
6+
args = sys.argv[1:]
7+
if len(args) == 2:
8+
# create from local file
9+
path = args[1]
10+
else:
11+
print('usage: python main.py <name> <filepath>')
12+
sys.exit(1)
13+
14+
# TODO: update to real Modelfile values
15+
modelfile = f"""
16+
FROM {path}
17+
"""
18+
19+
for response in create(model=args[0], modelfile=modelfile, stream=True):
20+
print(response['status'])

0 commit comments

Comments
 (0)