Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -10,24 +10,23 @@ import time
10
 
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
 
18
- #question_path = './{}.txt'.format(library)
19
- question_path = 'numpy.txt'
20
  # loading stackoverflow questions.
21
  # using huggingface load_dataset function.
22
  # not done yet
23
- #@st.cache
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 = {}
@@ -55,18 +54,15 @@ temp[tag] = question
55
  dataset.append(temp)
56
 
57
  # Select index
58
- number = st.number_input("Insert a index: range from",
59
- min_value = 0, max_value = len(dataset) - 1)
60
  st.write('The current index is ', number)
61
  data_index = int(number)
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
-
 
10
 
11
  import json
12
 
 
13
  st.title('StackOverflow Question Demo')
14
 
15
  library = st.radio('Select a library', ('numpy', 'tensorflow', 'pytorch', 'scipy', 'scikit-learn', 'pandas'))
16
 
17
+ question_path = './{}.txt'.format(library)
18
+ # question_path = 'numpy.txt'
19
  # loading stackoverflow questions.
20
  # using huggingface load_dataset function.
21
  # not done yet
22
+ # @st.cache
23
+ # def load_data(path):
24
  # return load_dataset('text', data_files = path, cache_dir = './data')
25
 
26
 
27
  dataset = []
28
+ # dataset = load_data(question_path)
29
+ with open(question_path) as f:
30
  lines = f.readlines()
31
  question = ''
32
  temp = {}
 
54
  dataset.append(temp)
55
 
56
  # Select index
57
+ number = st.number_input("Insert a index: range from",
58
+ min_value=0, max_value=len(dataset) - 1)
59
  st.write('The current index is ', number)
60
  data_index = int(number)
61
 
62
  # Selece modification
63
  options = tuple(dataset[data_index].keys())
64
  modification = st.radio('Modification:',
65
+ options=options
66
+ )
 
67
 
68
  st.write(dataset[data_index][modification])