Rezuwan commited on
Commit
db8f05b
·
verified ·
1 Parent(s): 411663c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -15,19 +15,24 @@ def get_chemical_info(chemical_name):
15
  output.append(f"Isotope Atom Count: {compound.isotope_atom_count}")
16
  output.append(f"Charge: {compound.charge}")
17
 
 
18
  output.append("\nAtoms:")
19
  for i, atom in enumerate(compound.atoms, start=1):
20
  output.append(f" Atom {i}: Element = {atom.element}")
21
 
 
22
  output.append("\nBonds:")
23
  for bond in compound.bonds:
24
- output.append(f" Bond between Atom {bond.a1} and Atom {bond.a2}, Order: {bond.order}")
 
 
25
 
26
  return "\n".join(output)
27
 
28
  except IndexError:
29
  return f"No information found for '{chemical_name}'. Please try a more precise name."
30
 
 
31
  # Gradio Interface
32
  demo = gr.Interface(
33
  fn=get_chemical_info,
 
15
  output.append(f"Isotope Atom Count: {compound.isotope_atom_count}")
16
  output.append(f"Charge: {compound.charge}")
17
 
18
+ # Atoms
19
  output.append("\nAtoms:")
20
  for i, atom in enumerate(compound.atoms, start=1):
21
  output.append(f" Atom {i}: Element = {atom.element}")
22
 
23
+ # Bonds
24
  output.append("\nBonds:")
25
  for bond in compound.bonds:
26
+ atom1 = bond.atom1.element
27
+ atom2 = bond.atom2.element
28
+ output.append(f" Bond between {atom1} and {atom2}, Order: {bond.order}")
29
 
30
  return "\n".join(output)
31
 
32
  except IndexError:
33
  return f"No information found for '{chemical_name}'. Please try a more precise name."
34
 
35
+
36
  # Gradio Interface
37
  demo = gr.Interface(
38
  fn=get_chemical_info,