diff options
author | terminaldweller <thabogre@gmail.com> | 2022-07-06 06:47:48 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2022-07-06 06:47:48 +0000 |
commit | 94a85a8b043e6fe2d3bfa77a460598927962a0ac (patch) | |
tree | 6484394d1914ee8d6fed8dee4388cb037763aa23 /cargo | |
parent | added docs for the /docs endpoint (diff) | |
download | devourer-94a85a8b043e6fe2d3bfa77a460598927962a0ac.tar.gz devourer-94a85a8b043e6fe2d3bfa77a460598927962a0ac.zip |
fixed a couple of the issues raised by codacy
Diffstat (limited to '')
-rwxr-xr-x | cargo/cargo.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cargo/cargo.py b/cargo/cargo.py index 821e235..a5144dd 100755 --- a/cargo/cargo.py +++ b/cargo/cargo.py @@ -1,12 +1,13 @@ #!/usr/bin/env python3 import http.server -import huggingface_hub as hh -import socketserver import os +import socketserver +import huggingface_hub as hh # https://huggingface.co/docs/huggingface_hub/how-to-downstream def download(path: str = ".") -> None: + """Download the required models from huggingface.""" bart_pretrained = hh.hf_hub_url( "sshleifer/distilbart-cnn-12-6", filename="config.json" ) @@ -14,11 +15,12 @@ def download(path: str = ".") -> None: def serve() -> None: + """Startup a simple http file server.""" handler = http.server.SimpleHTTPRequestHandler - PORT = os.environ["SERVER_PORT"] + port_number = os.environ["SERVER_PORT"] download(os.environ["SERVER_VAULT"]) - with socketserver.TCPServer(("", int(PORT)), handler) as httpd: + with socketserver.TCPServer(("", int(port_number)), handler) as httpd: httpd.serve_forever() |