diff --git a/.changeset/little-meals-enter.md b/.changeset/little-meals-enter.md new file mode 100644 index 0000000000000..4d29cef25739f --- /dev/null +++ b/.changeset/little-meals-enter.md @@ -0,0 +1,5 @@ +--- +"gradio": minor +--- + +feat:Apply Zero GPU for `gr.ChatInterface` diff --git a/gradio/chat_interface.py b/gradio/chat_interface.py index 691ea88149502..b97e69f92f7ed 100644 --- a/gradio/chat_interface.py +++ b/gradio/chat_interface.py @@ -331,8 +331,10 @@ def _setup_example_messages( return examples_messages def _setup_events(self) -> None: - submit_fn = self._stream_fn if self.is_generator else self._submit_fn submit_triggers = [self.textbox.submit, self.chatbot.retry] + submit_fn = self._stream_fn if self.is_generator else self._submit_fn + if hasattr(self.fn, "zerogpu"): + submit_fn.__func__.zerogpu = self.fn.zerogpu # type: ignore submit_event = ( self.textbox.submit(