Spaces:
janwari
/
Runtime error

vagmi commited on
Commit
503bed5
·
1 Parent(s): cd9e43b

More interface changes with updated labels

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -45,13 +45,13 @@ audio_examples = [
45
  ]
46
 
47
  df_init = pd.DataFrame(columns=['Task', 'Top 1', 'Top 2', 'Top 3', 'Top 4', 'Top 5'])
48
- transcription_df = gr.DataFrame(value=df_init, label="Output Dataframe", row_count=(
49
  0, "dynamic"), max_rows=30, wrap=True, overflow_row_behaviour='paginate')
50
  # outputs = [gr.components.Textbox()]
51
  outputs = transcription_df
52
 
53
  df_init_live = pd.DataFrame(columns=['Task', 'Top 1', 'Top 2', 'Top 3', 'Top 4', 'Top 5'])
54
- transcription_df_live = gr.DataFrame(value=df_init_live, label="Output Dataframe", row_count=(
55
  0, "dynamic"), max_rows=30, wrap=True, overflow_row_behaviour='paginate')
56
  outputs_live = transcription_df_live
57
 
@@ -100,7 +100,15 @@ ID2CLASS = {
100
 
101
  }
102
 
103
- TASKS = ['GS', 'MTGInstrument', 'MTGGenre', 'MTGTop50', 'MTGMood', 'NSynthI', 'NSynthP', 'VocalSetS', 'VocalSetT','EMO',]
 
 
 
 
 
 
 
 
104
  Regression_TASKS = ['EMO']
105
  head_dir = './Prediction_Head/best-layer-MERT-v1-95M'
106
  for task in TASKS:
@@ -159,7 +167,7 @@ def model_infernce(inputs):
159
  # task_output_texts = task_output_texts + f"TASK {task} output:\n" + "\n".join([str(ID2CLASS[task][str(sorted_idx[idx].item())])+f', probability: {sorted_prob[idx].item():.2%}' for idx in range(top_n_show)]) + '\n'
160
  # task_output_texts = task_output_texts + '----------------------\n'
161
 
162
- row_elements = [task]
163
  for idx in range(top_n_show):
164
  print(ID2CLASS[task])
165
  # print('id', str(sorted_idx[idx].item()))
 
45
  ]
46
 
47
  df_init = pd.DataFrame(columns=['Task', 'Top 1', 'Top 2', 'Top 3', 'Top 4', 'Top 5'])
48
+ transcription_df = gr.DataFrame(value=df_init, label="Model Results", row_count=(
49
  0, "dynamic"), max_rows=30, wrap=True, overflow_row_behaviour='paginate')
50
  # outputs = [gr.components.Textbox()]
51
  outputs = transcription_df
52
 
53
  df_init_live = pd.DataFrame(columns=['Task', 'Top 1', 'Top 2', 'Top 3', 'Top 4', 'Top 5'])
54
+ transcription_df_live = gr.DataFrame(value=df_init_live, label="Model Results", row_count=(
55
  0, "dynamic"), max_rows=30, wrap=True, overflow_row_behaviour='paginate')
56
  outputs_live = transcription_df_live
57
 
 
100
 
101
  }
102
 
103
+ #TASKS = ['GS', 'MTGInstrument', 'MTGGenre', 'MTGTop50', 'MTGMood', 'NSynthI', 'NSynthP', 'VocalSetS', 'VocalSetT','EMO',]
104
+ TASKS = ['GS', 'MTGInstrument', 'MTGGenre', 'MTGMood', 'EMO']
105
+ TASK_LABELS = {
106
+ 'GS': 'Scale',
107
+ 'MTGInstrument': 'Instruments',
108
+ 'MTGGenre': 'Genre',
109
+ 'MTGMood': 'Mood',
110
+ 'EMO','Emotion (Valence/Arousal'
111
+ }
112
  Regression_TASKS = ['EMO']
113
  head_dir = './Prediction_Head/best-layer-MERT-v1-95M'
114
  for task in TASKS:
 
167
  # task_output_texts = task_output_texts + f"TASK {task} output:\n" + "\n".join([str(ID2CLASS[task][str(sorted_idx[idx].item())])+f', probability: {sorted_prob[idx].item():.2%}' for idx in range(top_n_show)]) + '\n'
168
  # task_output_texts = task_output_texts + '----------------------\n'
169
 
170
+ row_elements = [TASK_LABELS[task]]
171
  for idx in range(top_n_show):
172
  print(ID2CLASS[task])
173
  # print('id', str(sorted_idx[idx].item()))