shaocongma commited on
Commit
6eb659a
1 Parent(s): c160ff7
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -95,7 +95,10 @@ def wrapped_generator(paper_title, paper_description, openai_api_key=None,
95
  return output
96
 
97
 
98
- def wrapped_references_generator(paper_title, num_refs):
 
 
 
99
  return generate_top_k_references(paper_title, top_k=num_refs)
100
 
101
 
@@ -232,7 +235,7 @@ with gr.Blocks(theme=theme) as demo:
232
 
233
  clear_button_refs.click(fn=clear_inputs_refs, inputs=[title_refs, slider_refs], outputs=[title_refs, slider_refs])
234
  submit_button_refs.click(fn=wrapped_references_generator,
235
- inputs=[title_refs, slider_refs], outputs=json_output)
236
 
237
  demo.queue(concurrency_count=1, max_size=5, api_open=False)
238
  demo.launch()
 
95
  return output
96
 
97
 
98
+ def wrapped_references_generator(paper_title, num_refs, openai_api_key=None):
99
+ if openai_api_key is not None:
100
+ openai.api_key = openai_api_key
101
+ openai.Model.list()
102
  return generate_top_k_references(paper_title, top_k=num_refs)
103
 
104
 
 
235
 
236
  clear_button_refs.click(fn=clear_inputs_refs, inputs=[title_refs, slider_refs], outputs=[title_refs, slider_refs])
237
  submit_button_refs.click(fn=wrapped_references_generator,
238
+ inputs=[title_refs, slider_refs, key], outputs=json_output)
239
 
240
  demo.queue(concurrency_count=1, max_size=5, api_open=False)
241
  demo.launch()