Skip to content

add title and description to ServeGradio #15639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Nov 12, 2022
11 changes: 10 additions & 1 deletion src/lightning_app/components/serve/gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class ServeGradio(LightningWork, abc.ABC):
outputs: Any
examples: Optional[List] = None
enable_queue: bool = False
title: Optional[str] = None
description: Optional[str] = None

def __init__(self, *args, **kwargs):
requires("gradio")(super().__init__(*args, **kwargs))
Expand Down Expand Up @@ -58,7 +60,14 @@ def run(self, *args, **kwargs):
self._model = self.build_model()
fn = partial(self.predict, *args, **kwargs)
fn.__name__ = self.predict.__name__
gradio.Interface(fn=fn, inputs=self.inputs, outputs=self.outputs, examples=self.examples).launch(
gradio.Interface(
fn=fn,
inputs=self.inputs,
outputs=self.outputs,
examples=self.examples,
title=self.title,
description=self.description,
).launch(
server_name=self.host,
server_port=self.port,
enable_queue=self.enable_queue,
Expand Down