Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
fcf15df1
"src/vscode:/vscode.git/clone" did not exist on "829f6defa44f93b84416aba36e5f43952c2df8bc"
Commit
fcf15df1
authored
Jun 26, 2023
by
Bruce MacDonald
Browse files
add cli
parent
2e99e7d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
README.md
README.md
+1
-1
proto.py
proto.py
+18
-2
No files found.
README.md
View file @
fcf15df1
...
@@ -13,7 +13,7 @@ pip install -r requirements.txt
...
@@ -13,7 +13,7 @@ pip install -r requirements.txt
Put your model in
`models/`
and run:
Put your model in
`models/`
and run:
```
```
python proto.py
python
3
proto.py
serve
```
```
To run the app:
To run the app:
...
...
proto.py
View file @
fcf15df1
import
json
import
json
import
os
import
os
import
threading
import
threading
import
click
from
llama_cpp
import
Llama
from
llama_cpp
import
Llama
from
flask
import
Flask
,
Response
,
stream_with_context
,
request
from
flask
import
Flask
,
Response
,
stream_with_context
,
request
from
flask_cors
import
CORS
from
flask_cors
import
CORS
...
@@ -100,6 +101,21 @@ def models_route_handler():
...
@@ -100,6 +101,21 @@ def models_route_handler():
return
Response
(
json
.
dumps
(
bin_files
),
mimetype
=
"application/json"
)
return
Response
(
json
.
dumps
(
bin_files
),
mimetype
=
"application/json"
)
@
click
.
group
(
invoke_without_command
=
True
)
@
click
.
pass_context
def
cli
(
ctx
):
# allows the script to respond to command line input when executed directly
if
ctx
.
invoked_subcommand
is
None
:
click
.
echo
(
ctx
.
get_help
())
@
cli
.
command
()
@
click
.
option
(
"--port"
,
default
=
5000
,
help
=
"Port to run the server on"
)
@
click
.
option
(
"--debug"
,
default
=
False
,
help
=
"Enable debug mode"
)
def
serve
(
port
,
debug
):
print
(
"Serving on http://localhost:{port}"
)
app
.
run
(
host
=
"0.0.0.0"
,
port
=
port
,
debug
=
debug
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
app
.
run
(
debug
=
True
,
threaded
=
True
,
port
=
5001
)
cli
()
app
.
run
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment