Spaces:
Sleeping
Sleeping
| # 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") | |