Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Dataframe.__init__() got an unexpected keyword argument 'height' in visualize.py #150

Open
joannaxie612 opened this issue Feb 27, 2025 · 3 comments · May be fixed by #152
Open
Assignees
Labels
bug Something isn't working CyFi explorer

Comments

@joannaxie612
Copy link

joannaxie612 commented Feb 27, 2025

When running the cyfi visualize command, I encountered the following error:

Copy
TypeError: Dataframe.init() got an unexpected keyword argument 'height'

The error occurs in the visualize.py script, specifically in the gr.DataFrame initialization where the height argument is passed.

This error seemed to resolve after removing the height=200 argument from the gr.DataFrame initialization in visualize.py, which then gave a link to a browser page with the CyFi Explorer.

with gr.Row():
data = gr.DataFrame(
df[
[
"sample_id",
"date",
"latitude",
"longitude",
"density_cells_per_ml",
"severity",
]
].style.format({"density_cells_per_ml": "{:,.0f}"}),
)

@ejm714
Copy link
Collaborator

ejm714 commented Feb 28, 2025

Hi @joannaxie612 thanks for filing the issue. Can you list out what commands you ran? I want to try reproducing the issue. Remember that you need the --keep-metadata flag for cyfi predict if you're planning to use the explorer afterwards. This makes sure that information about the Sentinel-2 tiles gets saved out. There are details here: https://cyfi.drivendata.org/explorer/#prerequisite-generating-predictions

@joannaxie612
Copy link
Author

joannaxie612 commented Feb 28, 2025

Hi @ejm714 , here are the commands I ran:

I installed cyfi using pip install (perhaps it was something with package versions/environment caused my issue?).

pip install cyfi

Then I ran the same sample points as in the tutorial at https://cyfi.drivendata.org/#quickstart in a folder cy_vis in my current directory

cyfi predict cy_vis/cy_test.csv --keep-metadata -d cy_vis/

This created sentinel_metadata.csv and preds.csv files in the cy_vis folder.

Then I ran:

cyfi visualize cy_vis/

Which then initially led me to encounter the error I described, that was resolved by editing the visualize.py script. After my edit, I could successfully open CyFi Visualize in my browser and results were as expected.

The full error message:

pd.to_datetime(df.date) - pd.to_timedelta(df.days_before_sample, unit="d")
╭─────────────────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────────────────╮
│ /home/thistle/miniforge3/lib/python3.12/site-packages/cyfi/visualize.py:160 in visualize │
│ │
│ 157 │ │ │ │ """ │
│ 158 │ │ │ ) │
│ 159 │ │ with gr.Row(): │
│ ❱ 160 │ │ │ data = gr.DataFrame( │
│ 161 │ │ │ │ df[ │
│ 162 │ │ │ │ │ [ │
│ 163 │ │ │ │ │ │ "sample_id", │
│ │
│ /home/thistle/miniforge3/lib/python3.12/site-packages/gradio/component_meta.py:181 in wrapper │
│ │
│ 178 │ │ if in_event_listener and initialized_before and not is_render: │
│ 179 │ │ │ return None │
│ 180 │ │ else: │
│ ❱ 181 │ │ │ return fn(self, **kwargs) │
│ 182 │ │
│ 183 │ return wrapper │
│ 184 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: Dataframe.init() got an unexpected keyword argument 'height'

@ejm714
Copy link
Collaborator

ejm714 commented Feb 28, 2025

Thanks so much for the clear repro instructions! Gradio changed this to max_height (gradio-app/gradio#9313) which is why we hit this error in more recent installs. I'll push a fix

@ejm714 ejm714 self-assigned this Feb 28, 2025
@ejm714 ejm714 added bug Something isn't working CyFi explorer labels Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CyFi explorer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants