ArmelR commited on
Commit
8ca88f2
·
1 Parent(s): 25903c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -2,27 +2,24 @@ import streamlit as st
2
  import json
3
  from datasets import load_dataset
4
 
5
- st.set_page_config(page_title="Bot Issues", layout="wide")
6
- st.title("Bot Issues")
7
 
8
  @st.cache()
9
  def load_data():
10
- ds = load_dataset("loubnabnl/bot_issues", split="train")
11
  return ds
12
 
13
- def print_issue(events):
14
- for event in events:
15
- st.markdown("""---""")
16
- masked_author = f"masked as {event['masked_author']}" if "masked_author" in event else ""
17
- st.markdown(f"**Author:** {event['author']} {masked_author}, {event['action']} {event['type']} with title: {event['title']}")
18
- st.markdown("Text:")
19
- st.code(f"{event['text']}", language="html")
20
 
21
  samples = load_data()
22
  col1, _ = st.columns([2, 4])
23
  with col1:
24
- 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)
25
 
26
- st.write(f"Issue size: {samples[index_example]['text_size_bots']}\n\n")
27
- print_issue(samples[index_example]["old_events"])
28
 
 
2
  import json
3
  from datasets import load_dataset
4
 
5
+ st.set_page_config(page_title="Stack-exchange visualization", layout="wide")
6
+ st.title("Stack-exchange visualization")
7
 
8
  @st.cache()
9
  def load_data():
10
+ ds = load_dataset("ArmelR/stack-exchange-sample10000", split="train")
11
  return ds
12
 
13
+ def print_question(example):
14
+ st.write("Question : ")
15
+ st.write(example["question"])
16
+ st.write("Answer : ")
17
+ st.write(example["response_j"])
 
 
18
 
19
  samples = load_data()
20
  col1, _ = st.columns([2, 4])
21
  with col1:
22
+ index_example = st.number_input(f"Index of the chosen question-answer pair from the existing {len(samples)}", min_value=0, max_value=len(samples)-1, value=0, step=1)
23
 
24
+ print_question(samples[index_example])
 
25