Spaces:
Runtime error
Runtime error
Commit
·
4a588d1
1
Parent(s):
a4fa2b9
Upload app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import time
|
|
11 |
import json
|
12 |
|
13 |
|
14 |
-
st.title('StackOverflow Question Demo
|
15 |
|
16 |
library = st.radio('Select a library', ('numpy', 'tensorflow', 'pytorch', 'scipy', 'scikit-learn', 'pandas'))
|
17 |
|
@@ -24,10 +24,10 @@ question_path = 'numpy.txt'
|
|
24 |
#def load_data(path):
|
25 |
# return load_dataset('text', data_files = path, cache_dir = './data')
|
26 |
|
27 |
-
|
28 |
dataset = []
|
29 |
#dataset = load_data(question_path)
|
30 |
-
with open(
|
31 |
lines = f.readlines()
|
32 |
question = ''
|
33 |
temp = {}
|
@@ -40,10 +40,18 @@ with open(question_path) as f:
|
|
40 |
temp[tag] = question
|
41 |
question = ''
|
42 |
tag = line[:-2]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
else:
|
44 |
if tag:
|
45 |
question += line
|
46 |
|
|
|
47 |
dataset.append(temp)
|
48 |
|
49 |
# Select index
|
@@ -54,11 +62,11 @@ data_index = int(number)
|
|
54 |
|
55 |
# Selece modification
|
56 |
options = tuple(dataset[data_index].keys())
|
57 |
-
modification = st.radio('
|
58 |
options = options
|
59 |
)
|
60 |
|
61 |
|
62 |
st.write(dataset[data_index][modification])
|
63 |
-
|
64 |
|
|
|
11 |
import json
|
12 |
|
13 |
|
14 |
+
st.title('StackOverflow Question Demo')
|
15 |
|
16 |
library = st.radio('Select a library', ('numpy', 'tensorflow', 'pytorch', 'scipy', 'scikit-learn', 'pandas'))
|
17 |
|
|
|
24 |
#def load_data(path):
|
25 |
# return load_dataset('text', data_files = path, cache_dir = './data')
|
26 |
|
27 |
+
'''
|
28 |
dataset = []
|
29 |
#dataset = load_data(question_path)
|
30 |
+
with open('numpy.txt') as f:
|
31 |
lines = f.readlines()
|
32 |
question = ''
|
33 |
temp = {}
|
|
|
40 |
temp[tag] = question
|
41 |
question = ''
|
42 |
tag = line[:-2]
|
43 |
+
elif re.match(r'\d*\.\n', line):
|
44 |
+
if tag:
|
45 |
+
temp[tag] = question
|
46 |
+
dataset.append(temp)
|
47 |
+
question = ''
|
48 |
+
tag = ''
|
49 |
+
temp = {}
|
50 |
else:
|
51 |
if tag:
|
52 |
question += line
|
53 |
|
54 |
+
temp[tag] = question
|
55 |
dataset.append(temp)
|
56 |
|
57 |
# Select index
|
|
|
62 |
|
63 |
# Selece modification
|
64 |
options = tuple(dataset[data_index].keys())
|
65 |
+
modification = st.radio('Modification:',
|
66 |
options = options
|
67 |
)
|
68 |
|
69 |
|
70 |
st.write(dataset[data_index][modification])
|
71 |
+
'''
|
72 |
|