import streamlit as st from streamlit_echarts import st_echarts import pandas as pd from annotated_text import annotated_text, annotation from utils import load_skill_extractor, create_dfs from utils import clean_text, default_text, predict_cat, load_model,get_match model = load_model() skill_extractor = load_skill_extractor() def app(): st.title("Enter or past the resume here") with st.form(key="text_val"): input_text = st.text_area('', value=default_text(), height=200) submit_button = st.form_submit_button(label="Submit") cls_text = clean_text(input_text) # st.write(cls_text) col1, col2,= st.columns(2) gaugeData = [ { "value": 0, "name": 'Match %', "detail": { "valueAnimation": True, "offsetCenter": ['0%', '0%'] } }] option = { "series": [ { "type": "gauge", "startAngle": 90, "endAngle": -270, "pointer": { "show": False, }, "progress": { "show": True, "overlap": False, "roundCap":False, "clip": False, "backgroundColor": '#11D1F9', "itemStyle": { "color": '#E96605', "borderWidth": 0, "borderColor": "light blue" } }, "axisLine": { "lineStyle": { "width": 40 } }, "splitLine": { "show": False, "distance": 0, "length": 20 }, "axisTick": { "show": False }, "axisLabel": { "show": False, "distance": 50 }, "data": gaugeData, "detail": { "valueAnimation": True, "offsetCenter": ['0%', '0%'], "width": 40, "height": 14, "fontSize": 24, "color": 'inherit', "borderColor": 'inherit', "borderRadius": 0, "borderWidth": 0, "formatter": '{value}%' }, } ] } prob,job_cat = predict_cat(model, cls_text) annotations = skill_extractor.annotate(cls_text,tresh=1) text = annotations['text'] annotations = annotations['results'] df = create_dfs(annotations) match = get_match(job_cat,df) with st.form(key='result'): if submit_button: gaugeData[0]['value']=match with col1: st.markdown("

Job Category

", unsafe_allow_html=True) html_str = f"""
{job_cat}
""" st.markdown(html_str, unsafe_allow_html=True ) # st.title("Probability") # st.markdown("

Probability

", unsafe_allow_html=True) html_match_str = f"""
Match percentage with top skills
""" st.markdown(html_match_str,unsafe_allow_html=True ) st_echarts(options=option, key="1") with col2: # st.markdown('-----------') df = create_dfs(annotations) st.markdown('## Extracted Skill :') st.write(", \n".join(df))