Spaces:
Runtime error
Runtime error
updated app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,20 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import datasets
|
| 3 |
+
from functools import partial
|
| 4 |
|
| 5 |
+
data = datasets.load_dataset("json", data_files="test_data.jsonl")["train"].select(range(100))
|
| 6 |
+
|
| 7 |
+
bad_cutoff = st.slider('Bad words cutoff', 0, 1)
|
| 8 |
+
stp_cutoff = st.slider('Stop words cutoff', 0, 1)
|
| 9 |
+
ppl_cutoff = st.slider('ppl cutoff', 0, 1)
|
| 10 |
+
|
| 11 |
+
def filter_ppl(examples, invert=False):
|
| 12 |
+
return [ppl < ppl_cutoff for ppl in examples["ppl"]]
|
| 13 |
+
|
| 14 |
+
def filter_bad(examples, invert=False):
|
| 15 |
+
return [bad < bad_cutoff for bad in examples["bad_words"]]
|
| 16 |
+
|
| 17 |
+
def filter_stp(examples, invert=False):
|
| 18 |
+
return [stp > stp_cutoff for stp in examples["stop_words"]]
|
| 19 |
+
|
| 20 |
+
st.table(data)
|