bstraehle commited on
Commit
f8bbfe3
·
1 Parent(s): c6755e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -26,7 +26,7 @@ def invoke(openai_api_key, prompt):
26
  if (prompt == ""):
27
  raise gr.Error("Prompt is required.")
28
 
29
- result = ""
30
 
31
  try:
32
  llm = ChatOpenAI(model_name = config["model_name"],
@@ -39,15 +39,15 @@ def invoke(openai_api_key, prompt):
39
  handle_parsing_errors = True,
40
  verbose = True)
41
 
42
- result = agent(prompt)
43
 
44
- #content = completion.choices[0].message.content
45
  except Exception as e:
46
  err_msg = e
47
 
48
  raise gr.Error(e)
49
 
50
- return result
51
 
52
  description = """<a href='https://www.gradio.app/'>Gradio</a> UI using the <a href='https://openai.com/'>OpenAI</a> API
53
  with <a href='https://openai.com/research/gpt-4'>gpt-4</a> model."""
 
26
  if (prompt == ""):
27
  raise gr.Error("Prompt is required.")
28
 
29
+ output = ""
30
 
31
  try:
32
  llm = ChatOpenAI(model_name = config["model_name"],
 
39
  handle_parsing_errors = True,
40
  verbose = True)
41
 
42
+ completion = agent(prompt)
43
 
44
+ output = completion.output
45
  except Exception as e:
46
  err_msg = e
47
 
48
  raise gr.Error(e)
49
 
50
+ return output
51
 
52
  description = """<a href='https://www.gradio.app/'>Gradio</a> UI using the <a href='https://openai.com/'>OpenAI</a> API
53
  with <a href='https://openai.com/research/gpt-4'>gpt-4</a> model."""