|
|
|
|
|
import streamlit as st
|
|
|
import pandas as pd
|
|
|
import numpy as np
|
|
|
import joblib
|
|
|
from sklearn.feature_extraction.text import TfidfVectorizer
|
|
|
from sklearn.linear_model import Ridge
|
|
|
from sklearn.multioutput import MultiOutputRegressor
|
|
|
|
|
|
|
|
|
st.title("📝 English Essay Skill Predictor")
|
|
|
st.markdown("Yazınızı girin, 6 dil puanını tahmin edelim (cohesion, syntax, etc.)")
|
|
|
|
|
|
|
|
|
user_text = st.text_area("✍️ Kompozisyonunuzu buraya yazın", height=250)
|
|
|
|
|
|
|
|
|
model = joblib.load("ridge_model.pkl")
|
|
|
tfidf = joblib.load("tfidf_vectorizer.pkl")
|
|
|
|
|
|
|
|
|
if st.button("📊 Tahmin Et"):
|
|
|
if user_text.strip() == "":
|
|
|
st.warning("Lütfen bir yazı girin.")
|
|
|
else:
|
|
|
|
|
|
text_vec = tfidf.transform([user_text])
|
|
|
preds = model.predict(text_vec)[0]
|
|
|
|
|
|
|
|
|
labels = ['Cohesion', 'Syntax', 'Vocabulary', 'Phraseology', 'Grammar', 'Conventions']
|
|
|
for label, score in zip(labels, preds):
|
|
|
st.write(f"**{label}**: {round(score, 2)} / 5")
|
|
|
|