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

[RND-176] Allow comet_llm in Python Panels #129

Merged
merged 7 commits into from
Jun 19, 2024

Conversation

dsblank
Copy link
Contributor

@dsblank dsblank commented Apr 19, 2024

This PR allows comet_llm.API() to get config settings from streamlit environment.

Requires: https://github.com/comet-ml/comet-python-client/pull/2407

How to test?

  1. Put the following in a file named page_test.py ("page_" is required).
  2. Run with streamlit run page_test.py
import streamlit as st
import os
if "comet_config_override" not in st.session_state:
    st.session_state["comet_config_override"] = {}
key = os.path.basename(__file__)
config = {
    "comet.url_override": 'https://www.comet.com/clientlib',
    "comet.api_key": 'YOUR-API-KEY',
    "comet.workspace": 'YOUR-WORKSPACE',
    "comet.project_name": 'YOUR-PROJECT',
    "COMET_EXPERIMENT_KEYS": ["YOUR-EXPERIMENT-KEY"],
    "COMET_PANEL_OPTIONS": {},
}
st.session_state["comet_config_override"][key] = config
# User code:
from comet_llm import API
import streamlit as st

api = API()

st.write(api)

If it doesn't work, you'll get an API key error. Otherwise, it will display the methods of api.

See also tests in comet_ml: https://github.com/comet-ml/comet-python-client/blob/master/comet-client-lib/tests/unit/test_streamlit.py

@dsblank dsblank requested a review from alexkuzmik April 19, 2024 15:57
@dsblank
Copy link
Contributor Author

dsblank commented Apr 19, 2024

I'm going to rewrite this so as not to expose streamlit stuff in comet_llm. I'll make a function to get the class over in comet_ml.

@dsblank
Copy link
Contributor Author

dsblank commented Apr 19, 2024

Ready for review.

@dsblank
Copy link
Contributor Author

dsblank commented May 29, 2024

This now works with changes in comet_ml.

@alexkuzmik alexkuzmik merged commit ce1c22a into main Jun 19, 2024
22 checks passed
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.

None yet

2 participants