In Gradio,
I tried chatinterface with “additional_inputs” and “examples” at the same time.
But, only either of them can work.
Question is …
How do I use those two features at the same time???
When “examples” is commented out, then, “additional_inputs” can work.
When “additional_inputs” is commented out, “examples” can work.
Here is the example I tried:
def yes_man(message, history, input1):
return f"{input1}"
with gr.Blocks() as demo:
input1 = gr.Textbox("", label="input1")
gr.ChatInterface(
yes_man,
examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"],
additional_inputs=[input1],
)
demo.launch()
- In this case, if input1 has “good”, the return should be “good” in the chatbot.
- Actually, not only “examples” but also other functions canot work, if “additional_inputs is used.
textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
New contributor
Yuna is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.