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

Introduce reprs for some of the base objects #15

Merged
merged 3 commits into from
Aug 24, 2023

Conversation

rgbkrk
Copy link
Contributor

@rgbkrk rgbkrk commented Aug 23, 2023

This introduces ipython / Jupyter representations for Python objects to allow easier viewing in a notebook.

For instance, running this code will display all the charts from lida.visualize

i = 0
library = "seaborn"
textgen_config = TextGenerationConfig(n=1, temperature=0.2, use_cache=True)
charts = lida.visualize(
    summary=summary, goal=goals[i], textgen_config=textgen_config, library=library
)
for chart in charts:
    display(chart)

image

and you can also just the chart be the execution result for the cell:

library = "seaborn"
textgen_config = TextGenerationConfig(n=1, temperature=0.2, use_cache=True)
charts = lida.visualize(
    summary=summary, goal=goals[i], textgen_config=textgen_config, library=library
)
charts[0]

image

Additionally, I did the same for goals:

image

Working on updating the notebook example as well once my machine has the infographics dependencies working well.

@rgbkrk
Copy link
Contributor Author

rgbkrk commented Aug 23, 2023

@microsoft-github-policy-service agree company="Noteable"

index: int
question: str
visualization: str
rationale: str

def _repr_markdown_(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the repr's.
I learned a few new things here @rgbkrk !!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always happy to sprinkle on some ipython goodness. 😄

@@ -101,12 +100,14 @@ def execute(
# raise Exception(
# "Permission to execute code not granted. Please set the environment variable LIDA_ALLOW_CODE_EVAL to '1' to allow code execution.")

if isinstance(summary, dict):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch here.

@victordibia victordibia merged commit ab6fac5 into microsoft:main Aug 24, 2023
1 check passed
@rgbkrk rgbkrk deleted the reprs branch August 25, 2023 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants