walter1 commited on
Commit
68757a8
1 Parent(s): e59f272

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -52
app.py CHANGED
@@ -25,43 +25,8 @@ def greet(string):
25
  print(prediction[0][np.argmax(prediction)])
26
  print("Predicted label: " + predicted_label + "\n")
27
 
28
- ###################
29
-
30
-
31
- spreadsheet_id = '1vjWnYsnGc0J6snT67NVbA-NWSGZ5b0eDBVHmg9lbf9s' # Please set the Spreadsheet ID.
32
- csv_url='https://docs.google.com/spreadsheets/d/' + spreadsheet_id + '/export?format=csv&id=' + spreadsheet_id + '&gid=0'
33
-
34
- res=requests.get(url=csv_url)
35
- open('google.csv', 'wb').write(res.content)
36
- df = pd.read_csv('google.csv')
37
-
38
-
39
-
40
- spreadsheet_id = '1vjWnYsnGc0J6snT67NVbA-NWSGZ5b0eDBVHmg9lbf9s' # Please set the Spreadsheet ID.
41
- url = 'https://script.google.com/macros/s/AKfycbwXP5fsDgOXJ9biZQC293o6bTBL3kDOJ07PlmxKjabzdTej6WYdC8Yos6NpDVqAJeVM/exec?spreadsheetId=' + spreadsheet_id
42
- body = {
43
- "arguments": {"range": "Sheet1!A"+str(len(df)+2), "valueInputOption": "USER_ENTERED"},
44
- "body": {"values": [[string]]}
45
- }
46
- res = requests.post(url, json.dumps(body), headers={'Content-Type': 'application/json'})
47
-
48
- body = {
49
- "arguments": {"range": "Sheet1!B"+str(len(df)+2), "valueInputOption": "USER_ENTERED"},
50
- "body": {"values": [[predicted_label]]}
51
- }
52
- res = requests.post(url, json.dumps(body), headers={'Content-Type': 'application/json'})
53
-
54
-
55
- current_time = datetime.datetime.now()
56
- body = {
57
- "arguments": {"range": "Sheet1!D"+str(len(df)+2), "valueInputOption": "USER_ENTERED"},
58
- "body": {"values": [[str(current_time)]]}
59
- }
60
- res = requests.post(url, json.dumps(body), headers={'Content-Type': 'application/json'})
61
- #print(res.text)
62
- #######################
63
  return predicted_label
64
- #One testing case
65
 
66
  ###################################################
67
 
@@ -141,22 +106,6 @@ def testQA(question):
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
 
 
25
  print(prediction[0][np.argmax(prediction)])
26
  print("Predicted label: " + predicted_label + "\n")
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  return predicted_label
29
+
30
 
31
  ###################################################
32
 
 
106
  #time3 = (datetime.now() - time).total_seconds()
107
 
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
 
111