John6666 commited on
Commit
cb05cc3
·
verified ·
1 Parent(s): 3a5bca8

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. hfsearch.py +2 -1
app.py CHANGED
@@ -19,7 +19,7 @@ with gr.Blocks(theme="NoCrypt/miku", fill_width=True, css=CSS) as demo:
19
  with gr.Row(equal_height=True):
20
  repo_types = gr.CheckboxGroup(label="Repo type", choices=["model", "dataset", "space", "collection"], value=["model", "dataset", "space"])
21
  filter_str = gr.Textbox(label="Filter", info="String(s) to filter repos", value="")
22
- sort = gr.Radio(label="Sort", choices=["last_modified", "likes", "downloads", "trending_score"], value="likes")
23
  with gr.Accordion("Advanced", open=False):
24
  ui_mode = gr.Radio(label="Mode", choices=["PC", "Phone"], value="Phone")
25
  with gr.Row(equal_height=True):
@@ -86,7 +86,7 @@ with gr.Blocks(theme="NoCrypt/miku", fill_width=True, css=CSS) as demo:
86
  sumbit_on_select=False)
87
  rec_repo_types = gr.CheckboxGroup(label="Repo type", choices=["model", "dataset", "space", "collection"], value=["model", "dataset", "space", "collection"])
88
  with gr.Row(equal_height=True):
89
- rec_sort = gr.Radio(label="Sort", choices=["last_modified", "likes", "downloads", "downloads_all_time", "trending_score"], value="likes")
90
  rec_limit = gr.Number(label="Limit", value=20, step=1, minimum=1, maximum=1000)
91
  with gr.Accordion("Advanced", open=False):
92
  with gr.Row(equal_height=True):
@@ -98,7 +98,7 @@ with gr.Blocks(theme="NoCrypt/miku", fill_width=True, css=CSS) as demo:
98
  #rec_repo_id = gr.Textbox(label="Repo ID", info="Input your favorite repo", value="")
99
  col_repo_id = HuggingfaceHubSearch(label="Repo ID or User ID", placeholder="Input your favorite Repo ID or User ID", search_type=["model", "dataset", "space", "user"],
100
  sumbit_on_select=False)
101
- col_sort = gr.Radio(label="Sort", choices=["last_modified", "trending_score", "likes"], value="likes")
102
  with gr.Row(equal_height=True):
103
  col_repo_limit = gr.Number(label="Limit for repos", value=50, step=1, minimum=1, maximum=100)
104
  col_user_limit = gr.Number(label="Limit for users", value=10, step=1, minimum=0, maximum=50)
 
19
  with gr.Row(equal_height=True):
20
  repo_types = gr.CheckboxGroup(label="Repo type", choices=["model", "dataset", "space", "collection"], value=["model", "dataset", "space"])
21
  filter_str = gr.Textbox(label="Filter", info="String(s) to filter repos", value="")
22
+ sort = gr.Dropdown(label="Sort", choices=["last_modified", "likes", "downloads", "trending_score"], value="likes")
23
  with gr.Accordion("Advanced", open=False):
24
  ui_mode = gr.Radio(label="Mode", choices=["PC", "Phone"], value="Phone")
25
  with gr.Row(equal_height=True):
 
86
  sumbit_on_select=False)
87
  rec_repo_types = gr.CheckboxGroup(label="Repo type", choices=["model", "dataset", "space", "collection"], value=["model", "dataset", "space", "collection"])
88
  with gr.Row(equal_height=True):
89
+ rec_sort = gr.Dropdown(label="Sort", choices=["last_modified", "likes", "downloads", "downloads_all_time", "trending_score"], value="likes")
90
  rec_limit = gr.Number(label="Limit", value=20, step=1, minimum=1, maximum=1000)
91
  with gr.Accordion("Advanced", open=False):
92
  with gr.Row(equal_height=True):
 
98
  #rec_repo_id = gr.Textbox(label="Repo ID", info="Input your favorite repo", value="")
99
  col_repo_id = HuggingfaceHubSearch(label="Repo ID or User ID", placeholder="Input your favorite Repo ID or User ID", search_type=["model", "dataset", "space", "user"],
100
  sumbit_on_select=False)
101
+ col_sort = gr.Dropdown(label="Sort", choices=["last_modified", "trending_score", "likes"], value="likes")
102
  with gr.Row(equal_height=True):
103
  col_repo_limit = gr.Number(label="Limit for repos", value=50, step=1, minimum=1, maximum=100)
104
  col_user_limit = gr.Number(label="Limit for users", value=10, step=1, minimum=0, maximum=50)
hfsearch.py CHANGED
@@ -649,7 +649,8 @@ class HFSearchResult():
649
  widths["Type"] = "10%"
650
  widths["ID"] = "90%"
651
  column_widths = [widths[l] for l in labels]
652
- return gr.update(type="pandas", value=df, headers=labels, datatype=label_types, column_widths=column_widths, wrap=True)
 
653
 
654
  def get_gr_hide_labels(self):
655
  return gr.update(choices=self.labels.get()[0], value=[], visible=True)
 
649
  widths["Type"] = "10%"
650
  widths["ID"] = "90%"
651
  column_widths = [widths[l] for l in labels]
652
+ if self.phone_mode: labels = None
653
+ return gr.update(type="pandas", value=df, headers=labels, datatype=label_types, column_widths=column_widths, wrap=True, show_label=False)
654
 
655
  def get_gr_hide_labels(self):
656
  return gr.update(choices=self.labels.get()[0], value=[], visible=True)