sasha HF Staff commited on
Commit
ba40560
·
verified ·
1 Parent(s): a69ed79

Update app.py

Browse files

changing 'returns' to gr.Info()

Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -31,7 +31,7 @@ class ModelDetails:
31
 
32
  def start_compute_space():
33
  API.restart_space(COMPUTE_SPACE)
34
- return f"Okay! {COMPUTE_SPACE} should be running now!"
35
 
36
 
37
  def get_model_size(model_info: ModelInfo):
@@ -73,19 +73,19 @@ def add_new_eval(
73
  task_models = list(API.list_models(filter=task_mappings[task]))
74
  task_model_names = [m.id for m in task_models]
75
  if repo_id in model_list:
76
- return 'This model has already been run!'
77
  elif repo_id not in task_model_names:
78
- return "This model isn't compatible with the chosen task! Pick a different model-task combination"
79
  else:
80
  # Is the model info correctly filled?
81
  try:
82
  model_info = API.model_info(repo_id=repo_id)
83
  except Exception:
84
- return "Could not find information for model %s" % (model)
85
 
86
  model_size = get_model_size(model_info=model_info)
87
 
88
- print("Adding request")
89
 
90
 
91
  request_dict = {
@@ -107,7 +107,7 @@ def add_new_eval(
107
  updated_dset =Dataset.from_pandas(df_final)
108
  updated_dset.push_to_hub("EnergyStarAI/requests_debug", split="test", token=TOKEN)
109
 
110
- print("Starting compute space at %s " % COMPUTE_SPACE)
111
  return start_compute_space()
112
 
113
  def print_existing_models():
@@ -166,6 +166,6 @@ with gr.Blocks() as demo:
166
  with gr.Column():
167
  with gr.Accordion("Models that are in the latest leaderboard version:", open = False):
168
  gr.Dataframe(get_leaderboard_models())
169
- with gr.Accordion("Models that have been benchmarked lately:", open = False):
170
  gr.Dataframe(print_existing_models())
171
  demo.launch()
 
31
 
32
  def start_compute_space():
33
  API.restart_space(COMPUTE_SPACE)
34
+ gr.Info(f"Okay! {COMPUTE_SPACE} should be running now!")
35
 
36
 
37
  def get_model_size(model_info: ModelInfo):
 
73
  task_models = list(API.list_models(filter=task_mappings[task]))
74
  task_model_names = [m.id for m in task_models]
75
  if repo_id in model_list:
76
+ gr.Info('This model has already been run!')
77
  elif repo_id not in task_model_names:
78
+ gr.Info("This model isn't compatible with the chosen task! Pick a different model-task combination")
79
  else:
80
  # Is the model info correctly filled?
81
  try:
82
  model_info = API.model_info(repo_id=repo_id)
83
  except Exception:
84
+ gr.Info("Could not find information for model %s" % (model))
85
 
86
  model_size = get_model_size(model_info=model_info)
87
 
88
+ gr.Info("Adding request")
89
 
90
 
91
  request_dict = {
 
107
  updated_dset =Dataset.from_pandas(df_final)
108
  updated_dset.push_to_hub("EnergyStarAI/requests_debug", split="test", token=TOKEN)
109
 
110
+ gr.Info("Starting compute space at %s " % COMPUTE_SPACE))
111
  return start_compute_space()
112
 
113
  def print_existing_models():
 
166
  with gr.Column():
167
  with gr.Accordion("Models that are in the latest leaderboard version:", open = False):
168
  gr.Dataframe(get_leaderboard_models())
169
+ with gr.Accordion("Models that have been benchmarked recently:", open = False):
170
  gr.Dataframe(print_existing_models())
171
  demo.launch()