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

Add grants_tagger visualize #74

Merged
merged 5 commits into from
Jul 6, 2021
Merged

Add grants_tagger visualize #74

merged 5 commits into from
Jul 6, 2021

Conversation

nsorros
Copy link
Contributor

@nsorros nsorros commented Jun 28, 2021

Adds grants_tagger vizualize command that runs a streamlit app. It allows the user to select a model, threshold and whether to display probabilities and then paste any text to get tags

Screenshot 2021-06-28 at 2 06 19 PM

@nsorros nsorros requested a review from aCampello June 28, 2021 11:03
Copy link
Contributor

@aCampello aCampello left a comment

Choose a reason for hiding this comment

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

Code looks good, and from the video/pictures the visualisation looks quite good too! Streamlit syntax seems nice and clean.

Seems to have a conflict with requirements.txt to fix before merging.

@app.command()
def visualize():
st_app_path = os.path.join(os.path.dirname(__file__), "streamlit_visualize.py")
subprocess.Popen(["streamlit", "run", st_app_path])
Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder if there is a way to run Streamlit programatically, like Flasks' import app; app.run()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not find a way, but will look again. Btw @jdu is this a good way if invoking a script? I remember hunter had mentioned that some python way was better than another

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a few different ways of spawning a sub-process across the different python versions. This is probably fine for what is just a labs component.

text = st.text_area('Grant abstract', 'The cell is...', height=300)

models = {
"disease_mesh_cnn-2021.03.1": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice model dispatcher, although in the future you can probably accept the model config file as parameter to your grants_tagger visualize.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I plan to save all these in meta.json so that I only have to pass the model_path


probabilities = st.sidebar.checkbox("Display probabilities")

with st.spinner('Calculating tags...'):
Copy link
Contributor

Choose a reason for hiding this comment

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

So easy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

<3 streamlit

@nsorros nsorros merged commit 19f452f into master Jul 6, 2021
@nsorros nsorros deleted the visualize branch July 6, 2021 14:11
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.

3 participants