Update app.py
Browse files
app.py
CHANGED
|
@@ -89,6 +89,7 @@ with st.spinner('Loading classification model...'):
|
|
| 89 |
from transformers import pipeline
|
| 90 |
|
| 91 |
checkpoint = "amir7d0/distilbert-base-uncased-finetuned-amazon-reviews"
|
|
|
|
| 92 |
classifier = pipeline("text-classification", model=checkpoint)
|
| 93 |
|
| 94 |
|
|
@@ -145,16 +146,17 @@ with tab2:
|
|
| 145 |
p_time = round(end_time-start_time, 2)
|
| 146 |
st.success(f'Prediction finished in {p_time}s!')
|
| 147 |
|
|
|
|
|
|
|
|
|
|
| 148 |
c1, c2 = st.columns([3, 1])
|
| 149 |
with c1:
|
| 150 |
st.subheader("π Check & download results")
|
| 151 |
with c2:
|
| 152 |
-
CSVButton2 = download_button(
|
| 153 |
|
| 154 |
st.header("")
|
| 155 |
|
| 156 |
-
for text, pred in zip(texts, preds):
|
| 157 |
-
pred['text'] = text
|
| 158 |
|
| 159 |
df = pd.DataFrame(preds, columns=['text', 'label', 'score'])
|
| 160 |
|
|
|
|
| 89 |
from transformers import pipeline
|
| 90 |
|
| 91 |
checkpoint = "amir7d0/distilbert-base-uncased-finetuned-amazon-reviews"
|
| 92 |
+
checkpoint = "/home/v4vendetta/Documents/bert-fa-base-uncased-sentiment-digikala"
|
| 93 |
classifier = pipeline("text-classification", model=checkpoint)
|
| 94 |
|
| 95 |
|
|
|
|
| 146 |
p_time = round(end_time-start_time, 2)
|
| 147 |
st.success(f'Prediction finished in {p_time}s!')
|
| 148 |
|
| 149 |
+
for text, pred in zip(texts, preds):
|
| 150 |
+
pred['text'] = text
|
| 151 |
+
|
| 152 |
c1, c2 = st.columns([3, 1])
|
| 153 |
with c1:
|
| 154 |
st.subheader("π Check & download results")
|
| 155 |
with c2:
|
| 156 |
+
CSVButton2 = download_button(preds, "sentiment-analysis-preds.csv", "π₯ Download (.csv)")
|
| 157 |
|
| 158 |
st.header("")
|
| 159 |
|
|
|
|
|
|
|
| 160 |
|
| 161 |
df = pd.DataFrame(preds, columns=['text', 'label', 'score'])
|
| 162 |
|