| import pandas as pd |
| import streamlit as st |
| from inference import inference |
| from inference import DebertaEvaluator |
|
|
| st.title("Essay Scoring") |
|
|
| categories=['cohesion', 'syntax', 'vocabulary', 'phraseology', 'grammar', 'conventions'] |
|
|
| initial_scores = {category: '-' for category in categories} |
| scores_df = pd.DataFrame(initial_scores, index=['Score']) |
|
|
| pd.set_option('display.float_format', lambda x: '%0.1f' % x) |
|
|
| text = "Here is a sample essay." |
|
|
| user_input = st.text_area("Enter your essay here:", value=text) |
|
|
| if st.button("Calculate Scores"): |
| scores = inference(user_input) |
| scores = [round(score * 2) / 2 for score in scores[0]] |
| new_table = {categories[i]: scores[i] for i in range(len(categories))} |
| scores_df = pd.DataFrame(new_table, index=['Score']) |
|
|
| |
| st.table(scores_df) |
|
|
|
|