Describe the bug
If you setup an update handler that outputs to a (default-initialized) dataframe you'll see an error like The truth value of a DataFrame is ambiguous.
Is there an existing issue for this?
Reproduction
This should crash on page load.
import gradio as gr
def new_data(data):
return gr.update(visible=True, value=data)
with gr.Blocks() as demo:
dataset = gr.Dataframe(visible=False)
query_result = gr.Dataframe(label="Data", visible=False)
gr.Examples(
examples=[["cereal.csv"]],
inputs=[dataset],
)
dataset.change(fn=new_data, inputs=[dataset], outputs=[query_result])
if __name__ == "__main__":
demo.launch(enable_queue=False)
You may need to create a file named cereal.csv locally. It can be something simple like:
name,mfr,type,calories,protein,fat,sodium,fiber,carbo,sugars,potass,vitamins,shelf,weight,cups,rating
100% Bran,N,C,70,4,1,130,10,5,6,280,25,3,1,0.33,68.402973
Screenshot
No response
Logs
File "/Users/ankur/projects/transformers/spaces/text2iql/venv/lib/python3.10/site-packages/gradio/routes.py", line 273, in run_predict
output = await app.blocks.process_api(
File "/Users/ankur/projects/transformers/spaces/text2iql/venv/lib/python3.10/site-packages/gradio/blocks.py", line 757, in process_api
predictions = self.postprocess_data(fn_index, result["prediction"], state)
File "/Users/ankur/projects/transformers/spaces/text2iql/venv/lib/python3.10/site-packages/gradio/blocks.py", line 706, in postprocess_data
if (
File "/Users/ankur/projects/transformers/spaces/text2iql/venv/lib/python3.10/site-packages/pandas/core/generic.py", line 1526, in __nonzero__
raise ValueError(
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
### System Info
```shell
gradio==3.3.1
### Severity
blocking upgrade to 3.3 (confirmed it works in 3.2)
Describe the bug
If you setup an update handler that outputs to a (default-initialized) dataframe you'll see an error like
The truth value of a DataFrame is ambiguous.Is there an existing issue for this?
Reproduction
This should crash on page load.
You may need to create a file named cereal.csv locally. It can be something simple like:
Screenshot
No response
Logs