Closed fabivencrim closed 2 years ago
Thanks for creating the issue @fabivencrim. The reason this issue was happening was that headers and data types were provided, which meant that new columns could not be processed correctly. There was previously no mechanism to prevent users from creating new columns in the front end, but as that is not desired in this case, we have added a mechanism to do so in #1186
You can add the following parameter to do this: col_count=(3, "fixed")
and the demo code has been updated:
import gradio as gr
def filter_records(records, gender):
return records[records["gender"] == gender]
demo = gr.Interface(
filter_records,
[
gr.Dataframe(
headers=["name", "age", "gender"],
datatype=["str", "number", "str"],
row_count=5,
col_count=(3, "fixed")
),
gr.Dropdown(["M", "F", "O"]),
],
"dataframe",
description="Enter gender as 'M', 'F', or 'O' for other.",
)
if __name__ == "__main__":
demo.launch()
Describe the bug
Hi,
I tried using the "New column" feature to populate custom data in the Dataframe component, but it seems to be giving me an error. When adding a new column and submitting, I get the following error :
ValueError: 3 columns passed, passed data had 4 columns
I tested this feature in the Colab example in the documentation and Gradio also flags an error when submitting.
Reproduction
Screenshot
Logs
System Info
Severity
blocker