Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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="
|
6 |
-
st.title("
|
7 |
|
8 |
@st.cache()
|
9 |
def load_data():
|
10 |
-
ds = load_dataset("
|
11 |
return ds
|
12 |
|
13 |
-
def
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
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
|
25 |
|
26 |
-
|
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 |
|