|
from libretranslate.app import create_app |
|
from libretranslate.default_values import DEFAULT_ARGUMENTS as DEFARGS |
|
from waitress import serve |
|
|
|
def create_args(): |
|
"""Return default arguments compatible with Hugging Face Spaces.""" |
|
class Args: |
|
def __init__(self): |
|
self.host = "0.0.0.0" |
|
self.port = 7860 |
|
self.debug = False |
|
self.ssl = False |
|
self.url_prefix = "" |
|
|
|
|
|
return Args() |
|
|
|
def main(): |
|
"""Main entry point for the application.""" |
|
args = create_args() |
|
app = create_app(args) |
|
print(f"Running on http://{args.host}:{args.port}{args.url_prefix}") |
|
serve(app, host=args.host, port=args.port) |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|