walter1 commited on
Commit
e59f272
·
1 Parent(s): a4e70b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -140,6 +140,27 @@ def testQA(question):
140
  answer = question_answerer(question = question, context = context['context'])['answer']
141
  #time3 = (datetime.now() - time).total_seconds()
142
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  output = coreName + ': ' + answer
144
  return output
145
 
 
140
  answer = question_answerer(question = question, context = context['context'])['answer']
141
  #time3 = (datetime.now() - time).total_seconds()
142
 
143
+
144
+ ## add to gsheet
145
+ spreadsheet_id = '1vjWnYsnGc0J6snT67NVbA-NWSGZ5b0eDBVHmg9lbf9s' # Please set the Spreadsheet ID.
146
+ csv_url='https://docs.google.com/spreadsheets/d/' + spreadsheet_id + '/export?format=csv&id=' + spreadsheet_id + '&gid=0'
147
+
148
+ res=rs.get(url=csv_url)
149
+ open('google2.csv', 'wb').write(res.content)
150
+ df = pd.read_csv('google2.csv')
151
+
152
+
153
+ spreadsheet_id = '1vjWnYsnGc0J6snT67NVbA-NWSGZ5b0eDBVHmg9lbf9s' # Please set the Spreadsheet ID.
154
+ url = 'https://script.google.com/macros/s/AKfycbwXP5fsDgOXJ9biZQC293o6bTBL3kDOJ07PlmxKjabzdTej6WYdC8Yos6NpDVqAJeVM/exec?spreadsheetId=' + spreadsheet_id
155
+ body = {
156
+ "arguments": {"range": "Sheet1!C"+str(len(df)+2), "valueInputOption": "USER_ENTERED"},
157
+ "body": {"values": [[answer]]}
158
+ }
159
+ res = requests.post(url, json.dumps(body), headers={'Content-Type': 'application/json'})
160
+
161
+
162
+
163
+
164
  output = coreName + ': ' + answer
165
  return output
166