File size: 1,002 Bytes
25903c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
import json
from datasets import load_dataset

st.set_page_config(page_title="Bot Issues", layout="wide")
st.title("Bot Issues")

@st.cache()
def load_data():
    ds = load_dataset("loubnabnl/bot_issues", split="train")
    return ds

def print_issue(events):
    for event in events:
        st.markdown("""---""")
        masked_author = f"masked as {event['masked_author']}" if "masked_author" in event else ""
        st.markdown(f"**Author:** {event['author']} {masked_author}, {event['action']} {event['type']} with title: {event['title']}")
        st.markdown("Text:")
        st.code(f"{event['text']}", language="html")

samples = load_data()
col1, _ = st.columns([2, 4])
with col1:
    index_example = st.number_input(f"Index of the chosen conversation from the existing {len(samples)}", min_value=0, max_value=len(samples)-1, value=0, step=1)

st.write(f"Issue size: {samples[index_example]['text_size_bots']}\n\n")
print_issue(samples[index_example]["old_events"])