Use gradio api in flux dev

This commit is contained in:
hlohaus 2025-02-21 13:19:28 +01:00
parent 78cb36dc71
commit 69d0b09816
3 changed files with 69 additions and 43 deletions

View file

@ -19,7 +19,6 @@ from ... import version, models
from ... import ChatCompletion, get_model_and_provider
from ... import debug
logger = logging.getLogger(__name__)
conversations: dict[dict[str, BaseConversation]] = {}
class Api:
@ -156,7 +155,6 @@ class Api:
has_images="images" in kwargs,
)
except Exception as e:
logger.exception(e)
debug.error(e)
yield self._format_json('error', type(e).__name__, message=get_error_message(e))
return
@ -186,7 +184,6 @@ class Api:
else:
yield self._format_json("conversation_id", conversation_id)
elif isinstance(chunk, Exception):
logger.exception(chunk)
debug.error(chunk)
yield self._format_json('message', get_error_message(chunk), error=type(chunk).__name__)
elif isinstance(chunk, PreviewResponse):
@ -222,7 +219,6 @@ class Api:
yield self._format_json("content", str(chunk))
yield from self._yield_logs()
except Exception as e:
logger.exception(e)
debug.error(e)
yield from self._yield_logs()
yield self._format_json('error', type(e).__name__, message=get_error_message(e))