Update app.py
Browse files
app.py
CHANGED
|
@@ -31,20 +31,18 @@ def load_model(show_spinner=True):
|
|
| 31 |
return yorum_model, tokenizer
|
| 32 |
|
| 33 |
st.set_page_config(layout='wide', initial_sidebar_state='expanded')
|
| 34 |
-
col1, col2= st.columns(2)
|
| 35 |
-
with col1:
|
| 36 |
-
st.title("TC32 Multi-Class Text Classification")
|
| 37 |
-
st.subheader('Model Loss and Accuracy')
|
| 38 |
-
st.markdown("<br>", unsafe_allow_html=True)
|
| 39 |
-
st.area_chart(chart_data, height=320)
|
| 40 |
-
yorum_model, tokenizer = load_model()
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
|
| 49 |
def prepare_data(input_text, tokenizer):
|
| 50 |
token = tokenizer.encode_plus(
|
|
@@ -66,14 +64,14 @@ def make_prediction(model, processed_data, classes=['Alışveriş','Anne-Bebek',
|
|
| 66 |
|
| 67 |
|
| 68 |
if text:
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
|
| 79 |
|
|
|
|
| 31 |
return yorum_model, tokenizer
|
| 32 |
|
| 33 |
st.set_page_config(layout='wide', initial_sidebar_state='expanded')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
st.title("TC32 Multi-Class Text Classification")
|
| 36 |
+
st.subheader('Model Loss and Accuracy')
|
| 37 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 38 |
+
st.area_chart(chart_data, height=320)
|
| 39 |
+
yorum_model, tokenizer = load_model()
|
| 40 |
|
| 41 |
+
|
| 42 |
+
st.title("Sınıfı bulmak için bir şikayet girin. (Ctrl+Enter)")
|
| 43 |
+
st.subheader("Enter complaint (in Turkish) to find the class.")
|
| 44 |
+
#st.subheader("Şikayet")
|
| 45 |
+
text = st.text_area("", "Bebeğim haftada bir kutu mama bitiriyor. Geçen hafta 135 tl'ye aldığım mama bugün 180 tl olmuş. Ben de artık aptamil almayacağım. Tüketici haklarına şikayet etmemiz gerekiyor. Yazıklar olsun.", height=285)
|
| 46 |
|
| 47 |
def prepare_data(input_text, tokenizer):
|
| 48 |
token = tokenizer.encode_plus(
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
if text:
|
| 67 |
+
|
| 68 |
+
with st.spinner('Wait for it...'):
|
| 69 |
+
processed_data = prepare_data(text, tokenizer)
|
| 70 |
+
result = make_prediction(yorum_model, processed_data=processed_data)
|
| 71 |
+
st.markdown("<br>", unsafe_allow_html=True)
|
| 72 |
+
st.success("Tahmin başarıyla tamamlandı!")
|
| 73 |
+
|
| 74 |
+
description = '<table style="border: collapse; padding-top: 1px;"><tr><div style="height: 62px;"></div></tr><tr><p style="border-width: medium; border-color: #aa5e70; border-radius: 10px;padding-top: 1px;padding-left: 20px;background:#20212a;font-family:Courier New; color: white;font-size: 36px; font-weight: boldest;">'+result+'</p></tr><table>'
|
| 75 |
+
st.markdown(description, unsafe_allow_html=True)
|
| 76 |
|
| 77 |
|