nooshinbah commited on
Commit
885b9dd
·
verified ·
1 Parent(s): 149d04f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -25,11 +25,10 @@ def fetch_and_parse_pdb(url):
25
  header_items = []
26
 
27
  for key, value in headers.items():
 
28
  if isinstance(value, list):
29
- for item in value:
30
- header_items.append((key, item))
31
- else:
32
- header_items.append((key, value))
33
 
34
  # Convert to DataFrame for better formatting
35
  df = pd.DataFrame(header_items, columns=['Header', 'Content'])
@@ -39,13 +38,20 @@ def fetch_and_parse_pdb(url):
39
 
40
  return df
41
 
42
- # Create Gradio interface
43
  iface = gr.Interface(
44
  fn=fetch_and_parse_pdb,
45
  inputs="text",
46
  outputs=gr.Dataframe(interactive=True),
47
- title="PDB Metadata Explorer",
48
- description="Input the URL of a Protein Data Bank (PDB) file and retrieve its metadata"
 
 
 
 
 
 
 
49
  )
50
 
51
  # Launch the interface
 
25
  header_items = []
26
 
27
  for key, value in headers.items():
28
+ # Convert lists to a string representation
29
  if isinstance(value, list):
30
+ value = ', '.join(value)
31
+ header_items.append((key, value))
 
 
32
 
33
  # Convert to DataFrame for better formatting
34
  df = pd.DataFrame(header_items, columns=['Header', 'Content'])
 
38
 
39
  return df
40
 
41
+ # Create Gradio interface with an informative title and description
42
  iface = gr.Interface(
43
  fn=fetch_and_parse_pdb,
44
  inputs="text",
45
  outputs=gr.Dataframe(interactive=True),
46
+ title="PDB Header Explorer",
47
+ description=(
48
+ "This tool allows you to input the URL of a Protein Data Bank (PDB) file "
49
+ "and retrieve its structural metadata. The information is displayed in an "
50
+ "interactive table, enabling sorting and filtering for easier analysis. "
51
+ "Understanding PDB headers is crucial for researchers and biologists as it provides "
52
+ "insight into the molecular structure and function of proteins, which is foundational "
53
+ "in fields like drug discovery, bioinformatics, and structural biology."
54
+ )
55
  )
56
 
57
  # Launch the interface