pseudotensor commited on
Commit
2927206
1 Parent(s): 2ce2260
Files changed (1) hide show
  1. src/gen.py +3 -3
src/gen.py CHANGED
@@ -2696,7 +2696,7 @@ def evaluate(
2696
  res = gr_client.predict(str(dict(client_kwargs)), api_name=api_name)
2697
  res_dict = ast.literal_eval(res)
2698
  text = res_dict['response']
2699
- sources = res_dict['sources']
2700
  response = prompter.get_response(prompt + text, prompt=prompt,
2701
  sanitize_bot_response=sanitize_bot_response)
2702
  yield dict(response=response, sources=sources, save_dict=dict())
@@ -2715,7 +2715,7 @@ def evaluate(
2715
  res = job.communicator.job.outputs[-1]
2716
  res_dict = ast.literal_eval(res)
2717
  text = res_dict['response']
2718
- sources = res_dict['sources']
2719
  if gr_prompt_type == 'plain':
2720
  # then gradio server passes back full prompt + text
2721
  prompt_and_text = text
@@ -2736,7 +2736,7 @@ def evaluate(
2736
  res = res_all[-1]
2737
  res_dict = ast.literal_eval(res)
2738
  text = res_dict['response']
2739
- sources = res_dict['sources']
2740
  else:
2741
  # go with old text if last call didn't work
2742
  e = job.future._exception
 
2696
  res = gr_client.predict(str(dict(client_kwargs)), api_name=api_name)
2697
  res_dict = ast.literal_eval(res)
2698
  text = res_dict['response']
2699
+ sources = res_dict.get('sources', '')
2700
  response = prompter.get_response(prompt + text, prompt=prompt,
2701
  sanitize_bot_response=sanitize_bot_response)
2702
  yield dict(response=response, sources=sources, save_dict=dict())
 
2715
  res = job.communicator.job.outputs[-1]
2716
  res_dict = ast.literal_eval(res)
2717
  text = res_dict['response']
2718
+ sources = res_dict.get('sources', '')
2719
  if gr_prompt_type == 'plain':
2720
  # then gradio server passes back full prompt + text
2721
  prompt_and_text = text
 
2736
  res = res_all[-1]
2737
  res_dict = ast.literal_eval(res)
2738
  text = res_dict['response']
2739
+ sources = res_dict.get('sources', '')
2740
  else:
2741
  # go with old text if last call didn't work
2742
  e = job.future._exception