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 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
yorum_model, tokenizer = load_model()
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
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)
|
| 48 |
|
| 49 |
def prepare_data(input_text, tokenizer):
|
| 50 |
token = tokenizer.encode_plus(
|
|
@@ -66,15 +64,11 @@ def make_prediction(model, processed_data, classes=['Alışveriş','Anne-Bebek',
|
|
| 66 |
|
| 67 |
|
| 68 |
if text:
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
with st.spinner('Wait for it...'):
|
| 75 |
-
processed_data = prepare_data(text, tokenizer)
|
| 76 |
-
result = make_prediction(yorum_model, processed_data=processed_data)
|
| 77 |
-
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>'
|
| 78 |
-
st.markdown(description, unsafe_allow_html=True)
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
| 31 |
return yorum_model, tokenizer
|
| 32 |
|
| 33 |
st.set_page_config(layout='wide', initial_sidebar_state='expanded')
|
| 34 |
+
st.markdown("<h1 style='text-align: center;'>TC32 Multi-Class Text Classification</h1><h3 style='text-align: center;'>Model Loss and Accuracy</h3>", unsafe_allow_html=True)
|
| 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 |
+
st.markdown("<h1 style='text-align: center;'>Sınıfı bulmak için bir şikayet girin. (Ctrl+Enter)</h1><h3 style='text-align: center;'>Enter complaint (in Turkish) to find the class.</h3>", unsafe_allow_html=True)
|
| 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 |
+
with st.spinner('Wait for it...'):
|
| 68 |
+
processed_data = prepare_data(text, tokenizer)
|
| 69 |
+
result = make_prediction(yorum_model, processed_data=processed_data)
|
| 70 |
+
#st.markdown("<br>", unsafe_allow_html=True)
|
| 71 |
+
st.success(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
# 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>'
|
| 74 |
+
# st.markdown(description, unsafe_allow_html=True)
|