brightfastwork commited on
Commit
fe98d91
·
1 Parent(s): 2256997

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -16
app.py CHANGED
@@ -147,19 +147,14 @@ def correct_number1(number):
147
  global num
148
  log.append([text_,'1-right',pr.loc[0,'predict'],pr.loc[0,'prob']])
149
  num +=1
150
- if (num%10 == 0):
151
- pd.DataFrame(log,columns=['title','label','sc_pred','prob']).to_csv('log_'+str(num)+'.csv',encoding='utf-8-sig')
152
- pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
153
  return 'thank for teaching the model'
154
 
155
  def correct_number2(number):
156
  global num
157
  log.append([text_,'1-wrong',pr.loc[0,'predict'],pr.loc[0,'prob']])
158
  log.append([text_,'2-right',pr.loc[1,'predict'],pr.loc[1,'prob']])
159
- num +=1
160
- if (num%10 == 0):
161
- pd.DataFrame(log,columns=['title','label','sc_pred','prob']).to_csv('log_'+str(num)+'.csv',encoding='utf-8-sig')
162
- pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
163
  return 'thank for teaching the model'
164
 
165
  def correct_number3(number):
@@ -167,10 +162,8 @@ def correct_number3(number):
167
  log.append([text_,'1-wrong',pr.loc[0,'predict'],pr.loc[0,'prob']])
168
  log.append([text_,'2-wrong',pr.loc[1,'predict'],pr.loc[1,'prob']])
169
  log.append([text_,'3-right',pr.loc[2,'predict'],pr.loc[2,'prob']])
170
- num +=1
171
- if (num%10 == 0):
172
- pd.DataFrame(log,columns=['title','label','sc_pred','prob']).to_csv('log_'+str(num)+'.csv',encoding='utf-8-sig')
173
- pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
174
  return 'thank for teaching the model'
175
 
176
  def feedback(correction_input,text_input):
@@ -179,11 +172,8 @@ def feedback(correction_input,text_input):
179
  log.append([text_,'2-wrong',pr.loc[1,'predict'],pr.loc[1,'prob']])
180
  log.append([text_,'3-wrong',pr.loc[2,'predict'],pr.loc[2,'prob']])
181
  log_correct.append([text_,'feedback',pr.loc[0,'predict'],pr.loc[0,'prob'],correction_input])
182
- num_2 +=1
183
- if (num_2%10 ==0):
184
- pd.DataFrame(log_correct,columns=['title','label','sc_pred','prob','real_sc']).to_csv('log_correct_'+str(num_2)+'.csv', encoding = 'utf-8-sig')
185
- pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
186
- pygsheets_df(pd.DataFrame(log_correct,columns=['title','label','sc_pred','prob','real_sc']),tab_name = 'correction')
187
  return 'thank for teaching the model'
188
  with demo:
189
 
 
147
  global num
148
  log.append([text_,'1-right',pr.loc[0,'predict'],pr.loc[0,'prob']])
149
  num +=1
150
+ pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
 
 
151
  return 'thank for teaching the model'
152
 
153
  def correct_number2(number):
154
  global num
155
  log.append([text_,'1-wrong',pr.loc[0,'predict'],pr.loc[0,'prob']])
156
  log.append([text_,'2-right',pr.loc[1,'predict'],pr.loc[1,'prob']])
157
+ pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
 
 
 
158
  return 'thank for teaching the model'
159
 
160
  def correct_number3(number):
 
162
  log.append([text_,'1-wrong',pr.loc[0,'predict'],pr.loc[0,'prob']])
163
  log.append([text_,'2-wrong',pr.loc[1,'predict'],pr.loc[1,'prob']])
164
  log.append([text_,'3-right',pr.loc[2,'predict'],pr.loc[2,'prob']])
165
+
166
+ pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
 
 
167
  return 'thank for teaching the model'
168
 
169
  def feedback(correction_input,text_input):
 
172
  log.append([text_,'2-wrong',pr.loc[1,'predict'],pr.loc[1,'prob']])
173
  log.append([text_,'3-wrong',pr.loc[2,'predict'],pr.loc[2,'prob']])
174
  log_correct.append([text_,'feedback',pr.loc[0,'predict'],pr.loc[0,'prob'],correction_input])
175
+ pygsheets_df(pd.DataFrame(log,columns=['title','label','sc_pred','prob']))
176
+ pygsheets_df(pd.DataFrame(log_correct,columns=['title','label','sc_pred','prob','real_sc']),tab_name = 'correction')
 
 
 
177
  return 'thank for teaching the model'
178
  with demo:
179