khizon commited on
Commit
dc90e78
1 Parent(s): bb7435f

cache model

Browse files
Files changed (2) hide show
  1. app.py +1 -0
  2. download_dataset.py +0 -2
app.py CHANGED
@@ -34,6 +34,7 @@ def demo_predict(df_row):
34
  outputs = [{"Emotion": config.id2label[i], "Score": round(score * 100, 3)} for i, score in enumerate(scores)]
35
  return outputs
36
 
 
37
  def cache_model():
38
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
39
  model_name_or_path = 'khizon/greek-speech-emotion-classifier-demo'
 
34
  outputs = [{"Emotion": config.id2label[i], "Score": round(score * 100, 3)} for i, score in enumerate(scores)]
35
  return outputs
36
 
37
+ @st.cache(allow_output_mutation=True)
38
  def cache_model():
39
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
40
  model_name_or_path = 'khizon/greek-speech-emotion-classifier-demo'
download_dataset.py CHANGED
@@ -26,12 +26,10 @@ if __name__ == '__main__':
26
  name = str(path).split("/")[-1]
27
  label = str(path).split('/')[-2]
28
  path = os.path.join("data", "aesdd", label, name)
29
- print(path)
30
 
31
  try:
32
  # There are some broken files
33
  s = torchaudio.load(path)
34
- print(s)
35
  data.append({
36
  "name": name,
37
  "path": path,
 
26
  name = str(path).split("/")[-1]
27
  label = str(path).split('/')[-2]
28
  path = os.path.join("data", "aesdd", label, name)
 
29
 
30
  try:
31
  # There are some broken files
32
  s = torchaudio.load(path)
 
33
  data.append({
34
  "name": name,
35
  "path": path,