diff --git a/generate.py b/generate.py index 44d69b27d..365514933 100644 --- a/generate.py +++ b/generate.py @@ -89,7 +89,6 @@ def main( cli: bool = False, cli_loop: bool = True, gradio: bool = True, - gradio_avoid_processing_markdown: bool = False, gradio_offline_level: int = 0, chat: bool = True, chat_context: bool = False, @@ -185,7 +184,6 @@ def main( :param cli: whether to use CLI (non-gradio) interface. :param cli_loop: whether to loop for CLI (False usually only for testing) :param gradio: whether to enable gradio, or to enable benchmark mode - :param gradio_avoid_processing_markdown: :param gradio_offline_level: > 0, then change fonts so full offline == 1 means backend won't need internet for fonts, but front-end UI might if font not cached == 2 means backend and frontend don't need internet to download any fonts. diff --git a/gradio_runner.py b/gradio_runner.py index 695a2151b..7bb980593 100644 --- a/gradio_runner.py +++ b/gradio_runner.py @@ -122,33 +122,6 @@ def go_gradio(**kwargs): css_code = get_css(kwargs) - if kwargs['gradio_avoid_processing_markdown']: - from gradio_client import utils as client_utils - from gradio.components import Chatbot - - # gradio has issue with taking too long to process input/output for markdown etc. - # Avoid for now, allow raw html to render, good enough for chatbot. - def _postprocess_chat_messages(self, chat_message: str): - if chat_message is None: - return None - elif isinstance(chat_message, (tuple, list)): - filepath = chat_message[0] - mime_type = client_utils.get_mimetype(filepath) - filepath = self.make_temp_copy_if_needed(filepath) - return { - "name": filepath, - "mime_type": mime_type, - "alt_text": chat_message[1] if len(chat_message) > 1 else None, - "data": None, # These last two fields are filled in by the frontend - "is_file": True, - } - elif isinstance(chat_message, str): - return chat_message - else: - raise ValueError(f"Invalid message for Chatbot component: {chat_message}") - - Chatbot._postprocess_chat_messages = _postprocess_chat_messages - if kwargs['gradio_offline_level'] >= 0: # avoid GoogleFont that pulls from internet if kwargs['gradio_offline_level'] == 1: