From 29e5bfb5838c2840addd8c6d8f7b82b9fb23c5c0 Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Fri, 11 Mar 2022 17:01:03 -0500 Subject: [PATCH] Fix type of server returned by `Launchable` (#810) * `Launchable` returns a FastAPI now * Update .gitignore Former-commit-id: ab67ce3dee572c380465145f3cd6873f7232c14f [formerly ab67ce3dee572c380465145f3cd6873f7232c14f [formerly 94fac2e3df9f971f9dc7ae941447e600a6ae58d6]] Former-commit-id: 8f3286222adedac2cab99e7b49375ec0e05c032b Former-commit-id: 03286cf5231b06b024a00b03ca63d01def19df24 --- .gitignore | 1 + gradio/interface.py | 1 - gradio/launchable.py | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 87fca09af6..a672381e20 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ demo/files/*.mp4 *.bak workspace.code-workspace *.h5 +.vscode/ # log files .pnpm-debug.log \ No newline at end of file diff --git a/gradio/interface.py b/gradio/interface.py index 8891f52ee7..ab12ee21d6 100644 --- a/gradio/interface.py +++ b/gradio/interface.py @@ -31,7 +31,6 @@ from gradio.process_examples import load_from_cache, process_example from gradio.routes import PredictBody if TYPE_CHECKING: # Only import for type checking (is False at runtime). - import flask import transformers diff --git a/gradio/launchable.py b/gradio/launchable.py index c10ff5f217..dc63e8ff93 100644 --- a/gradio/launchable.py +++ b/gradio/launchable.py @@ -11,7 +11,7 @@ from gradio import encryptor, networking, queueing, strings, utils # type: igno from gradio.process_examples import cache_interface_examples if TYPE_CHECKING: # Only import for type checking (is False at runtime). - import flask + import fastapi class Launchable: @@ -42,7 +42,7 @@ class Launchable: ssl_keyfile: Optional[str] = None, ssl_certfile: Optional[str] = None, ssl_keyfile_password: Optional[str] = None, - ) -> Tuple[flask.Flask, str, str]: + ) -> Tuple[fastapi.FastAPI, str, str]: """ Launches the webserver that serves the UI for the interface. Parameters: @@ -68,7 +68,7 @@ class Launchable: ssl_certfile (str): If a path to a file is provided, will use this as the signed certificate for https. Needs to be provided if ssl_keyfile is provided. ssl_keyfile_password (str): If a password is provided, will use this with the ssl certificate for https. Returns: - app (flask.Flask): Flask app object + app (fastapi.FastAPI): FastAPI app object path_to_local_server (str): Locally accessible link share_url (str): Publicly accessible link (if share=True) """