File size: 1,145 Bytes
73af081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# app.py
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

# Başlık
st.title("📝 English Essay Skill Predictor")
st.markdown("Yazınızı girin, 6 dil puanını tahmin edelim (cohesion, syntax, etc.)")

# Kullanıcıdan metin al
user_text = st.text_area("✍️ Kompozisyonunuzu buraya yazın", height=250)

# Model ve TF-IDF yükleme (önceden eğitilmiş)
model = joblib.load("ridge_model.pkl")
tfidf = joblib.load("tfidf_vectorizer.pkl")

# Tahmin butonu
if st.button("📊 Tahmin Et"):
    if user_text.strip() == "":
        st.warning("Lütfen bir yazı girin.")
    else:
        # Vektörleştir
        text_vec = tfidf.transform([user_text])
        preds = model.predict(text_vec)[0]

        # Sonuçları göster
        labels = ['Cohesion', 'Syntax', 'Vocabulary', 'Phraseology', 'Grammar', 'Conventions']
        for label, score in zip(labels, preds):
            st.write(f"**{label}**: {round(score, 2)} / 5")