edf commited on
Commit
1964c50
1 Parent(s): 9b26e4c

didn't remve all the args refs

Browse files
Files changed (1) hide show
  1. app.py +5 -29
app.py CHANGED
@@ -303,7 +303,7 @@ if __name__ == '__main__':
303
  chat_history = ConversationBufferMemory(memory_key="chat_history",
304
  input_key="input",
305
  return_messages=True)
306
- agent = create_agent(model, tools, chat_history, args)
307
  def agent_wrapper(query, history):
308
  resp = agent.run({'input': query,
309
  'chat_history': history,
@@ -311,31 +311,7 @@ if __name__ == '__main__':
311
  'tool_names': (t.name for t in tools)})
312
  return resp
313
 
314
- if args.no_gradio:
315
- initial_prompt = "What would you like to know?"
316
- prompt = initial_prompt
317
- exit_cmd = ['QUIT', 'EXIT']
318
- while True:
319
- try:
320
- query = input(prompt + "\n> ")
321
- if query.upper() in exit_cmd:
322
- break
323
- if len(query.strip()) == 0:
324
- prompt = initial_prompt
325
- continue
326
- resp = agent_wrapper(query, chat_history)
327
- prompt = resp
328
- except EOFError:
329
- break
330
- except Exception as e:
331
- print(e.__class__.__name__)
332
- print(traceback.format_exc())
333
- print("Terminating due to unexpected error: " + str(e))
334
- prompt = initial_prompt
335
-
336
- else:
337
-
338
- app = gr.ChatInterface(agent_wrapper)
339
- #app = gr.Interface(agent_wrapper)
340
- #iface = fn=agent_wrapper, inputs="text", outputs="text")
341
- app.launch() #server_name=args.addr, server_port=int(args.port))
 
303
  chat_history = ConversationBufferMemory(memory_key="chat_history",
304
  input_key="input",
305
  return_messages=True)
306
+ agent = create_agent(model, tools, chat_history)
307
  def agent_wrapper(query, history):
308
  resp = agent.run({'input': query,
309
  'chat_history': history,
 
311
  'tool_names': (t.name for t in tools)})
312
  return resp
313
 
314
+ app = gr.ChatInterface(agent_wrapper)
315
+ #app = gr.Interface(agent_wrapper)
316
+ #iface = fn=agent_wrapper, inputs="text", outputs="text")
317
+ app.launch() #server_name=args.addr, server_port=int(args.port))