Spaces:
Runtime error
Runtime error
clean up sentences section
Browse files
app.py
CHANGED
@@ -22,16 +22,21 @@ min_value = st.slider('Select minimum selfcheck score', 0.0, maximum_score, 0.1,
|
|
22 |
|
23 |
ds = load_data(min_score=min_value, exclude_stories=exclude_stories)
|
24 |
index = st.number_input(f'Found {len(ds)} samples, choose one', min_value=0, max_value=len(ds)-1, value=0, step=1)
|
|
|
25 |
|
26 |
# Load data based on slider values and checkbox status
|
27 |
sample = ds[index]
|
28 |
st.markdown(f"**Passage Score:** {sample['passage_score']:.2f}, **seed data**: {sample['seed_data']}, **format**: {sample['format']}.")
|
29 |
st.markdown("---")
|
|
|
30 |
st.markdown(sample['original_text'])
|
31 |
|
32 |
# get inconsistent sentences
|
33 |
-
st.subheader("🤔 Sentences with a high inconsistency score")
|
34 |
sentences = sample["sentences_and_scores"]
|
35 |
sentences = [e for e in sentences if e["score"] > 0.5]
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
22 |
|
23 |
ds = load_data(min_score=min_value, exclude_stories=exclude_stories)
|
24 |
index = st.number_input(f'Found {len(ds)} samples, choose one', min_value=0, max_value=len(ds)-1, value=0, step=1)
|
25 |
+
min_score = st.number_input(f'Choose threshold for diplayed inconsistent sentences', min_value=0.2, max_value=1.0, value=0.4, step=0.1)
|
26 |
|
27 |
# Load data based on slider values and checkbox status
|
28 |
sample = ds[index]
|
29 |
st.markdown(f"**Passage Score:** {sample['passage_score']:.2f}, **seed data**: {sample['seed_data']}, **format**: {sample['format']}.")
|
30 |
st.markdown("---")
|
31 |
+
st.subheader("📕 Generated text")
|
32 |
st.markdown(sample['original_text'])
|
33 |
|
34 |
# get inconsistent sentences
|
35 |
+
st.subheader("🤔 Sentences with a high inconsistency score (> 0.5)")
|
36 |
sentences = sample["sentences_and_scores"]
|
37 |
sentences = [e for e in sentences if e["score"] > 0.5]
|
38 |
+
sentences = sorted(sentences, key=lambda d: d['score'], reverse=True)
|
39 |
+
|
40 |
+
for i, s in enumerate(sentences):
|
41 |
+
st.markdown(f"**Sentence {i}** with score {s['score']:.2f}:\n{s['sentence']}")
|
42 |
+
st.markdown("---")
|