Upgrade promptui to conform to Gradio V4 (#98)

This commit is contained in:
Duc Nguyen (john)
2023-12-07 15:24:07 +07:00
committed by GitHub
parent 797df5a69c
commit 1f927d3391
7 changed files with 68 additions and 56 deletions

View File

@@ -84,9 +84,7 @@ def handle_node(node: dict) -> dict:
def handle_input(pipeline: Union[BaseComponent, Type[BaseComponent]]) -> dict:
"""Get the input from the pipeline"""
if not hasattr(pipeline, "run_raw"):
return {}
signature = inspect.signature(pipeline.run_raw)
signature = inspect.signature(pipeline.run)
inputs: Dict[str, Dict] = {}
for name, param in signature.parameters.items():
if name in ["self", "args", "kwargs"]:

View File

@@ -4,7 +4,7 @@ from typing import Any, AsyncGenerator
import anyio
from gradio import ChatInterface
from gradio.components import IOComponent, get_component_instance
from gradio.components import Component, get_component_instance
from gradio.events import on
from gradio.helpers import special_args
from gradio.routes import Request
@@ -20,7 +20,7 @@ class ChatBlock(ChatInterface):
def __init__(
self,
*args,
additional_outputs: str | IOComponent | list[str | IOComponent] | None = None,
additional_outputs: str | Component | list[str | Component] | None = None,
**kwargs,
):
if additional_outputs: