AmitGarage's picture
Update app.py
e1e950a
raw
history blame
1.69 kB
import spacy_streamlit
import streamlit as st
import typer
from scripts.torch_ner_model import build_torch_ner_model
from scripts.torch_ner_pipe import make_torch_entity_recognizer
def main(models: str = None, default_text: str = None):
st.title('NER Predictor')
#st.header('Enter the characteristics of the diamond:')
#carat = st.number_input('Carat Weight:', min_value=0.1, max_value=10.0, value=1.0)
#cut = st.selectbox('Cut Rating:', ['Fair', 'Good', 'Very Good', 'Premium', 'Ideal'])
#color = st.selectbox('Color Rating:', ['J', 'I', 'H', 'G', 'F', 'E', 'D'])
#clarity = st.selectbox('Clarity Rating:', ['I1', 'SI2', 'SI1', 'VS2', 'VS1', 'VVS2', 'VVS1', 'IF'])
#depth = st.number_input('Diamond Depth Percentage:', min_value=0.1, max_value=100.0, value=1.0)
#table = st.number_input('Diamond Table Percentage:', min_value=0.1, max_value=100.0, value=1.0)
#x = st.number_input('Diamond Length (X) in mm:', min_value=0.1, max_value=100.0, value=1.0)
#y = st.number_input('Diamond Width (Y) in mm:', min_value=0.1, max_value=100.0, value=1.0)
#z = st.number_input('Diamond Height (Z) in mm:', min_value=0.1, max_value=100.0, value=1.0)
models = "training_trf/model-best"
default_text = "The patient had surgery."
models = [name.strip() for name in models.split(",")]
labels = ["person", "problem", "pronoun", "test", "treatment"]
#if st.button('Predict Price'):
# st.success(f'The predicted price of the diamond is USD')
spacy_streamlit.visualize(models, default_text, visualizers=["ner"], ner_labels=labels)
if __name__ == "__main__":
try:
typer.run(main)
except SystemExit:
pass