Rezuwan commited on
Commit
cefc489
·
verified ·
1 Parent(s): 5f39686

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -17,10 +17,9 @@ def get_chemical_info(chemical_name):
17
 
18
  # Atoms
19
  output.append("\nAtoms:")
20
- atom_dict = {}
21
- for atom in compound.atoms:
22
- atom_dict[atom.idx] = atom.element
23
- output.append(f" Atom {atom.idx}: Element = {atom.element}")
24
 
25
  # Bonds
26
  output.append("\nBonds:")
@@ -34,7 +33,6 @@ def get_chemical_info(chemical_name):
34
  except IndexError:
35
  return f"No information found for '{chemical_name}'. Please try a more precise name."
36
 
37
-
38
  # Gradio Interface
39
  demo = gr.Interface(
40
  fn=get_chemical_info,
 
17
 
18
  # Atoms
19
  output.append("\nAtoms:")
20
+ atom_dict = {i + 1: atom.element for i, atom in enumerate(compound.atoms)}
21
+ for idx, element in atom_dict.items():
22
+ output.append(f" Atom {idx}: Element = {element}")
 
23
 
24
  # Bonds
25
  output.append("\nBonds:")
 
33
  except IndexError:
34
  return f"No information found for '{chemical_name}'. Please try a more precise name."
35
 
 
36
  # Gradio Interface
37
  demo = gr.Interface(
38
  fn=get_chemical_info,