matanninio commited on
Commit
7e647be
1 Parent(s): d688be8

OK, works via markdown, with huggingface emoji

Browse files
Files changed (1) hide show
  1. app.py +21 -16
app.py CHANGED
@@ -64,15 +64,18 @@ def create_application():
64
  *visibility,
65
  )
66
  else:
67
- return (gr.update(visible=False), *visibility)
68
 
69
  def model_change(value):
70
- return gr.update(link=f"../../../{value}", visible=True)
71
- # return gr.update(link=f"https://huggingface.co/{value}", visible=True)
 
 
72
 
73
  with gr.Blocks(theme="Zarkel/IBM_Carbon_Theme") as application:
74
  task_dropdown = gr.Dropdown(
75
- choices=["Select task"] + list(all_tasks.keys()), label="Mammal Task"
 
76
  )
77
  task_dropdown.interactive = True
78
  with gr.Row():
@@ -87,9 +90,21 @@ def create_application():
87
  visible=False,
88
  scale=10,
89
  )
90
- goto_card_button = gr.Button(
91
- "Link to model card", size="sm", scale=0, visible=False
 
92
  )
 
 
 
 
 
 
 
 
 
 
 
93
  model_name_dropdown.change(
94
  model_change, inputs=[model_name_dropdown], outputs=[goto_card_button]
95
  )
@@ -104,16 +119,6 @@ def create_application():
104
  ],
105
  )
106
 
107
- # def set_demo_vis(main_text):
108
- # main_text=main_text
109
- # print(f"main text is {main_text}")
110
- # return gr.Group(visible=True)
111
- # #return gr.Group(visible=(main_text == "PPI"))
112
- # # , gr.Group( visible=(main_text == "DTI") )
113
-
114
- # task_dropdown.change(
115
- # set_ppi_vis, inputs=task_dropdown, outputs=[ppi_demo]
116
- # )
117
  return application
118
 
119
 
 
64
  *visibility,
65
  )
66
  else:
67
+ return (gr.update(visible=False, value=None), *visibility)
68
 
69
  def model_change(value):
70
+ return gr.update(
71
+ value=f'[<span style="font-size:4em;">🤗</span>to model](https://huggingface.co/{value})',
72
+ visible=value is not None,
73
+ )
74
 
75
  with gr.Blocks(theme="Zarkel/IBM_Carbon_Theme") as application:
76
  task_dropdown = gr.Dropdown(
77
+ choices=["Select task"] + list(all_tasks.keys()),
78
+ label="Mammal Task",
79
  )
80
  task_dropdown.interactive = True
81
  with gr.Row():
 
90
  visible=False,
91
  scale=10,
92
  )
93
+ goto_card_button = gr.Markdown(
94
+ "Link to model card",
95
+ visible=False,
96
  )
97
+
98
+ def echo(value):
99
+ print(value)
100
+ return value
101
+
102
+ # goto_card_button.click(
103
+ # fn=None,
104
+ # inputs=model_name_dropdown,
105
+ # js=f"(model_name_dropdown) => {{ window.open('https://huggingface.co/{model_name_dropdown}', '_blank') }}",
106
+ # )
107
+
108
  model_name_dropdown.change(
109
  model_change, inputs=[model_name_dropdown], outputs=[goto_card_button]
110
  )
 
119
  ],
120
  )
121
 
 
 
 
 
 
 
 
 
 
 
122
  return application
123
 
124