-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
There was a problem hiding this 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]) |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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...'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So easy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3 streamlit
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