Add1E commited on
Commit
ea492b0
·
1 Parent(s): 738d8c0

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +12 -1
utils.py CHANGED
@@ -5,8 +5,16 @@ from sklearn.ensemble import RandomForestRegressor
5
  import pandas as pd
6
  from tqdm.auto import tqdm
7
  import streamlit as st
 
 
8
  tqdm.pandas()
9
 
 
 
 
 
 
 
10
 
11
  def predict_popularity(features, trainset):
12
  predictions = [None] * 2
@@ -23,7 +31,10 @@ def addToCsvAndTrain(trainset):
23
  ]
24
  neues_df = pd.DataFrame(trainset, columns= data.columns)
25
  df = pd.concat([data, neues_df], ignore_index=True)
26
- df.to_csv('top50.csv', index=False)
 
 
 
27
 
28
 
29
  data = pd.read_csv('top50.csv', encoding='ISO-8859-1')
 
5
  import pandas as pd
6
  from tqdm.auto import tqdm
7
  import streamlit as st
8
+ from huggingface_hub import Repository, HfApi
9
+ import os
10
  tqdm.pandas()
11
 
12
+ # Authentifizierung (stellen Sie sicher, dass Ihr Hugging Face Token gesetzt ist)
13
+ api = HfApi()
14
+ token = api.login(os.getenv("login"), os.getenv("passwort"))
15
+
16
+ # Erstellen oder Klonen Sie ein Repository (wenn noch nicht vorhanden)
17
+ repo = Repository(local_dir="SpotifyHitPrediction", clone_from="Add1E/SpotifyHitPrediction")
18
 
19
  def predict_popularity(features, trainset):
20
  predictions = [None] * 2
 
31
  ]
32
  neues_df = pd.DataFrame(trainset, columns= data.columns)
33
  df = pd.concat([data, neues_df], ignore_index=True)
34
+ df.to_csv('SpotifyHitPrediction/top50.csv', index=False)
35
+ repo.git_add('top50.csv')
36
+ repo.git_commit("Add top50.csv")
37
+ repo.git_push()
38
 
39
 
40
  data = pd.read_csv('top50.csv', encoding='ISO-8859-1')