cafierom commited on
Commit
a5b2294
·
verified ·
1 Parent(s): 8c790af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -489,15 +489,16 @@ def MoleculeAgent(smiles, name, task):
489
  for c in graph.stream(input): #, stream_mode='updates'):
490
  m = re.findall(r'[a-z]+\_node', str(c))
491
  if len(m) != 0:
492
- reply = c[str(m[0])]['messages']
493
- print("======== DEBUG ================")
494
- print(c)
495
- if 'assistant' in str(reply):
496
- reply = str(reply).split("<|assistant|>")[-1].split('#')[0].strip()
497
- replies.append(reply)
498
- else:
499
- reply = str(c).split("<|assistant|>")[-1].split('#')[0].strip()
500
- replies.append(reply)
 
501
  #check if image exists
502
  if os.path.exists('Similars_image.png'):
503
  img_loc = 'Similars_image.png'
 
489
  for c in graph.stream(input): #, stream_mode='updates'):
490
  m = re.findall(r'[a-z]+\_node', str(c))
491
  if len(m) != 0:
492
+ try:
493
+ reply = c[str(m[0])]['messages']
494
+ print("======== DEBUG ================")
495
+ print(c)
496
+ if 'assistant' in str(reply):
497
+ reply = str(reply).split("<|assistant|>")[-1].split('#')[0].strip()
498
+ replies.append(reply)
499
+ except:
500
+ reply = str(c).split("<|assistant|>")[-1].split('#')[0].strip()
501
+ replies.append(reply)
502
  #check if image exists
503
  if os.path.exists('Similars_image.png'):
504
  img_loc = 'Similars_image.png'