Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -51,8 +51,6 @@ api = HfApi()
|
|
51 |
#csv_file = 'data.csv'
|
52 |
global_df = pd.DataFrame()
|
53 |
print(type(global_df))
|
54 |
-
data = pd.read_csv("https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/export?format=csv&gid=0")
|
55 |
-
print(data)
|
56 |
|
57 |
@bot.event
|
58 |
async def on_ready():
|
@@ -62,6 +60,7 @@ async def on_ready():
|
|
62 |
# testing sheet -> read -> paste sheet
|
63 |
|
64 |
"""import data from google sheets -> HF Space .csv (doesn't make API call this way, as it's read-only)"""
|
|
|
65 |
data['discord_user_id'] = data['discord_user_id'].astype(str)
|
66 |
print(data)
|
67 |
global_df = data
|
@@ -342,9 +341,10 @@ def run_bot():
|
|
342 |
threading.Thread(target=run_bot).start()
|
343 |
|
344 |
|
|
|
|
|
|
|
345 |
def get_data():
|
346 |
-
URL = "https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/edit#gid=0"
|
347 |
-
csv_url = URL.replace('/edit#gid=', '/export?format=csv&gid=')
|
348 |
getdata = pd.read_csv(csv_url)
|
349 |
first_3_columns = getdata.iloc[:, 1:4]
|
350 |
first_3_columns.to_csv('first_3_columns.csv', index=False)
|
|
|
51 |
#csv_file = 'data.csv'
|
52 |
global_df = pd.DataFrame()
|
53 |
print(type(global_df))
|
|
|
|
|
54 |
|
55 |
@bot.event
|
56 |
async def on_ready():
|
|
|
60 |
# testing sheet -> read -> paste sheet
|
61 |
|
62 |
"""import data from google sheets -> HF Space .csv (doesn't make API call this way, as it's read-only)"""
|
63 |
+
data = pd.read_csv("https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/export?format=csv&gid=0")
|
64 |
data['discord_user_id'] = data['discord_user_id'].astype(str)
|
65 |
print(data)
|
66 |
global_df = data
|
|
|
341 |
threading.Thread(target=run_bot).start()
|
342 |
|
343 |
|
344 |
+
URL = "https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/edit#gid=0"
|
345 |
+
csv_url = URL.replace('/edit#gid=', '/export?format=csv&gid=')
|
346 |
+
|
347 |
def get_data():
|
|
|
|
|
348 |
getdata = pd.read_csv(csv_url)
|
349 |
first_3_columns = getdata.iloc[:, 1:4]
|
350 |
first_3_columns.to_csv('first_3_columns.csv', index=False)
|