Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
import tensorflow as tf
|
5 |
import numpy as np
|
6 |
import pickle
|
@@ -24,6 +23,30 @@ def greet(string):
|
|
24 |
|
25 |
print(prediction[0][np.argmax(prediction)])
|
26 |
print("Predicted label: " + predicted_label + "\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
return predicted_label
|
29 |
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
import tensorflow as tf
|
4 |
import numpy as np
|
5 |
import pickle
|
|
|
23 |
|
24 |
print(prediction[0][np.argmax(prediction)])
|
25 |
print("Predicted label: " + predicted_label + "\n")
|
26 |
+
|
27 |
+
###################
|
28 |
+
import requests as rs
|
29 |
+
import pandas as pd
|
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=rs.get(url=csv_url)
|
35 |
+
open('google.csv', 'wb').write(res.content)
|
36 |
+
df = pd.read_csv('google.csv')
|
37 |
+
|
38 |
+
import json
|
39 |
+
import requests
|
40 |
+
|
41 |
+
spreadsheet_id = '1vjWnYsnGc0J6snT67NVbA-NWSGZ5b0eDBVHmg9lbf9s' # Please set the Spreadsheet ID.
|
42 |
+
body = {
|
43 |
+
"arguments": {"range": "Sheet1!A"+str(len(df)+2), "valueInputOption": "USER_ENTERED"},
|
44 |
+
"body": {"values": [[string]]}
|
45 |
+
}
|
46 |
+
url = 'https://script.google.com/macros/s/AKfycbwXP5fsDgOXJ9biZQC293o6bTBL3kDOJ07PlmxKjabzdTej6WYdC8Yos6NpDVqAJeVM/exec?spreadsheetId=' + spreadsheet_id
|
47 |
+
res = requests.post(url, json.dumps(body), headers={'Content-Type': 'application/json'})
|
48 |
+
print(res.text)
|
49 |
+
#######################
|
50 |
|
51 |
return predicted_label
|
52 |
|