davidberenstein1957 HF staff commited on
Commit
c69c644
1 Parent(s): 6bd9538

Update app to include json pipline

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -44,7 +44,7 @@ def _get_tag_category(entry: list[str], tag_category: str):
44
  def _check_pipeline(repo_id):
45
  for file_type in [".json", ".yaml", ".yml"]:
46
  file_path = f"datasets/{repo_id}/pipeline{file_type}"
47
- url = f"https://huggingface.co/{file_path}"
48
  if fs.exists(file_path):
49
  return get_config_from_url(url)
50
 
@@ -83,10 +83,7 @@ def _create_modal_info(row: dict) -> str:
83
  _get_main_title(repo_id=row["id"]),
84
  _embed_dataset_viewer(repo_id=row["id"]),
85
  _get_dataset_card(repo_id=row["id"]),
86
- ]), "<br>".join([
87
- _get_main_title(repo_id=row["id"]),
88
- f'pipeline available: {_check_pipeline(repo_id=row["id"])}'
89
- ])
90
 
91
  # Define the Gradio interface
92
  with gr.Blocks(delete_cache=[1,1]) as demo:
@@ -118,12 +115,13 @@ with gr.Blocks(delete_cache=[1,1]) as demo:
118
  with gr.Tab(label="dataset"):
119
  markdown_1 = gr.HTML()
120
  with gr.Tab(label="pipeline"):
121
- markdown_2 = gr.HTML()
122
 
123
  def update(leader_board: pd.DataFrame, markdown_1, markdown_2, evt: gr.SelectData):
124
  if not isinstance(evt.index, int):
125
  leader_board_filtered = leader_board[leader_board["id"] == evt.value]
126
  if leader_board_filtered.empty:
 
127
  gr.Info("Press a cell with the repo id.")
128
  else:
129
  row = leader_board_filtered.iloc[0].to_dict()
 
44
  def _check_pipeline(repo_id):
45
  for file_type in [".json", ".yaml", ".yml"]:
46
  file_path = f"datasets/{repo_id}/pipeline{file_type}"
47
+ url = f"https://huggingface.co/datasets/{repo_id}/raw/main/pipeline{file_type}"
48
  if fs.exists(file_path):
49
  return get_config_from_url(url)
50
 
 
83
  _get_main_title(repo_id=row["id"]),
84
  _embed_dataset_viewer(repo_id=row["id"]),
85
  _get_dataset_card(repo_id=row["id"]),
86
+ ]), _check_pipeline(repo_id=row["id"])
 
 
 
87
 
88
  # Define the Gradio interface
89
  with gr.Blocks(delete_cache=[1,1]) as demo:
 
115
  with gr.Tab(label="dataset"):
116
  markdown_1 = gr.HTML()
117
  with gr.Tab(label="pipeline"):
118
+ markdown_2 = gr.JSON()
119
 
120
  def update(leader_board: pd.DataFrame, markdown_1, markdown_2, evt: gr.SelectData):
121
  if not isinstance(evt.index, int):
122
  leader_board_filtered = leader_board[leader_board["id"] == evt.value]
123
  if leader_board_filtered.empty:
124
+ modal = Modal(visible=False)
125
  gr.Info("Press a cell with the repo id.")
126
  else:
127
  row = leader_board_filtered.iloc[0].to_dict()