ssilwal commited on
Commit
a0111b4
·
1 Parent(s): 32f65c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -280,28 +280,28 @@ if st.session_state['show'] and st.session_state['results']!=None:
280
 
281
  st.write(line)
282
 
283
- rate = st.slider('Please rate this output', min_value= 0, max_value=5, key='slider', on_change=callback, args=('slider','0'))
284
 
285
- if st.session_state['slider'] !=0:
286
- rate = st.session_state['slider']
287
- st.write(f'You rated {rate}')
288
 
289
 
290
 
291
- if st.button('Submit', key='rate'):
292
- if st.session_state['results']!=None:
293
- item = {'query': st.session_state['query'], 'results': st.session_state['results'], 'model': st.session_state['model'],'rating': st.session_state['slider']}
294
- try:
295
- with open('human.json','r') as file:
296
- import json
297
- archive = json.load(file)
298
- archive.append(item)
299
- with open('human.json','w') as file:
300
- json.dump(archive, file)
301
- except FileNotFoundError:
302
- import json
303
- data = [item]
304
- print(data)
305
- with open('human.json','w') as file:
306
- json.dump(data, file)
307
 
 
280
 
281
  st.write(line)
282
 
283
+ # rate = st.slider('Please rate this output', min_value= 0, max_value=5, key='slider', on_change=callback, args=('slider','0'))
284
 
285
+ # if st.session_state['slider'] !=0:
286
+ # rate = st.session_state['slider']
287
+ # st.write(f'You rated {rate}')
288
 
289
 
290
 
291
+ # if st.button('Submit', key='rate'):
292
+ # if st.session_state['results']!=None:
293
+ # item = {'query': st.session_state['query'], 'results': st.session_state['results'], 'model': st.session_state['model'],'rating': st.session_state['slider']}
294
+ # try:
295
+ # with open('human.json','r') as file:
296
+ # import json
297
+ # archive = json.load(file)
298
+ # archive.append(item)
299
+ # with open('human.json','w') as file:
300
+ # json.dump(archive, file)
301
+ # except FileNotFoundError:
302
+ # import json
303
+ # data = [item]
304
+ # print(data)
305
+ # with open('human.json','w') as file:
306
+ # json.dump(data, file)
307