roni commited on
Commit
d46e61e
·
1 Parent(s): 098b486

updaing gradio vsion

Browse files
Files changed (3) hide show
  1. .gitignore +2 -1
  2. README.md +1 -1
  3. app.py +22 -9
.gitignore CHANGED
@@ -1,4 +1,5 @@
1
  .idea
2
  venv
3
  __pycache__
4
- scratch
 
 
1
  .idea
2
  venv
3
  __pycache__
4
+ scratch
5
+ .env
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🧬
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 3.20.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 4.37.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -97,12 +97,21 @@ def update_dropdown_menu(agg_search_res):
97
  choices.append(choice)
98
 
99
  if choices:
100
- update = gr.Dropdown.update(
101
- choices=choices, interactive=True, value=choices[0], visible=True
 
 
 
 
102
  )
 
103
  else:
104
- update = gr.Dropdown.update(
105
- choices=choices, interactive=True, visible=False, value=None
 
 
 
 
106
  )
107
  return update
108
 
@@ -122,17 +131,21 @@ def parse_pdb_search_result(raw_result):
122
  def switch_viz(new_choice):
123
  if new_choice is None:
124
  html = ""
125
- title_update = gr.Markdown.update(visible=False)
126
- description_update = gr.Markdown.update(value=None, visible=False)
 
 
127
  else:
128
  choice_parts = new_choice.split(choice_sep)
129
  pdb_id, chain = choice_parts[1:3]
130
- title_update = gr.Markdown.update(visible=True)
131
  pdb_title = get_pdb_title(pdb_id)
132
 
133
  new_value = f"""**PDB Title**: {pdb_title}"""
134
 
135
- description_update = gr.Markdown.update(value=new_value, visible=True)
 
 
136
  html = render_html(pdb_id=pdb_id, chain=chain)
137
  return html, title_update, description_update
138
 
@@ -153,7 +166,7 @@ with gr.Blocks() as demo:
153
  )
154
  search_button = gr.Button("Search", variant="primary")
155
  search_results = gr.Label(
156
- num_top_classes=max_results, label="Search Results"
157
  )
158
  viz_header = gr.Markdown("## Visualization", visible=False)
159
  results_selector = gr.Dropdown(
 
97
  choices.append(choice)
98
 
99
  if choices:
100
+ update = gr.update(
101
+ gr.Dropdown.get_component_class_id(),
102
+ choices=choices,
103
+ interactive=True,
104
+ value=choices[0],
105
+ visible=True,
106
  )
107
+
108
  else:
109
+ update = gr.update(
110
+ gr.Dropdown.get_component_class_id(),
111
+ choices=choices,
112
+ interactive=True,
113
+ visible=False,
114
+ value=None,
115
  )
116
  return update
117
 
 
131
  def switch_viz(new_choice):
132
  if new_choice is None:
133
  html = ""
134
+ title_update = gr.update(gr.Markdown.get_component_class_id(), visible=False)
135
+ description_update = gr.update(
136
+ gr.Markdown.get_component_class_id(), value=None, visible=False
137
+ )
138
  else:
139
  choice_parts = new_choice.split(choice_sep)
140
  pdb_id, chain = choice_parts[1:3]
141
+ title_update = gr.update(gr.Markdown.get_component_class_id(), visible=True)
142
  pdb_title = get_pdb_title(pdb_id)
143
 
144
  new_value = f"""**PDB Title**: {pdb_title}"""
145
 
146
+ description_update = gr.update(
147
+ gr.Markdown.get_component_class_id(), value=new_value, visible=True
148
+ )
149
  html = render_html(pdb_id=pdb_id, chain=chain)
150
  return html, title_update, description_update
151
 
 
166
  )
167
  search_button = gr.Button("Search", variant="primary")
168
  search_results = gr.Label(
169
+ num_top_classes=max_results, label="Search Results", scale=2
170
  )
171
  viz_header = gr.Markdown("## Visualization", visible=False)
172
  results_selector = gr.Dropdown(