walter1 commited on
Commit
10688b7
·
1 Parent(s): 9d29d4f

Update app.py

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