Fix type of server returned by Launchable (#810)

* `Launchable` returns a FastAPI now

* Update .gitignore

Former-commit-id: ab67ce3dee [formerly ab67ce3dee [formerly ab67ce3dee [formerly 94fac2e3df]]]
Former-commit-id: 8f3286222adedac2cab99e7b49375ec0e05c032b
Former-commit-id: 03286cf5231b06b024a00b03ca63d01def19df24
Former-commit-id: 29e5bfb583
This commit is contained in:
Julien Chaumond 2022-03-11 17:01:03 -05:00 committed by GitHub
parent 9a41f1b5c1
commit 9ba043673e
3 changed files with 4 additions and 4 deletions

1
.gitignore vendored
View File

@ -38,6 +38,7 @@ demo/files/*.mp4
*.bak *.bak
workspace.code-workspace workspace.code-workspace
*.h5 *.h5
.vscode/
# log files # log files
.pnpm-debug.log .pnpm-debug.log

View File

@ -31,7 +31,6 @@ from gradio.process_examples import load_from_cache, process_example
from gradio.routes import PredictBody from gradio.routes import PredictBody
if TYPE_CHECKING: # Only import for type checking (is False at runtime). if TYPE_CHECKING: # Only import for type checking (is False at runtime).
import flask
import transformers import transformers

View File

@ -11,7 +11,7 @@ from gradio import encryptor, networking, queueing, strings, utils # type: igno
from gradio.process_examples import cache_interface_examples from gradio.process_examples import cache_interface_examples
if TYPE_CHECKING: # Only import for type checking (is False at runtime). if TYPE_CHECKING: # Only import for type checking (is False at runtime).
import flask import fastapi
class Launchable: class Launchable:
@ -42,7 +42,7 @@ class Launchable:
ssl_keyfile: Optional[str] = None, ssl_keyfile: Optional[str] = None,
ssl_certfile: Optional[str] = None, ssl_certfile: Optional[str] = None,
ssl_keyfile_password: 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. Launches the webserver that serves the UI for the interface.
Parameters: 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_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. ssl_keyfile_password (str): If a password is provided, will use this with the ssl certificate for https.
Returns: Returns:
app (flask.Flask): Flask app object app (fastapi.FastAPI): FastAPI app object
path_to_local_server (str): Locally accessible link path_to_local_server (str): Locally accessible link
share_url (str): Publicly accessible link (if share=True) share_url (str): Publicly accessible link (if share=True)
""" """