Your Name commited on
Commit
2fd6e0d
·
1 Parent(s): 8b05d75
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -41,13 +41,12 @@ agent_chain = initialize_agent(
41
  memory=memory
42
  )
43
 
44
- def chat(message, site,history):
45
  history = history or []
46
  #siteの//以前を削除
47
- site = site.replace("https://","")
48
  response = ""
49
  try:
50
- response = agent_chain.run(input=message+" site:"+site)
51
  except KeyError:
52
  if not response:
53
  response = "not found in the site"
@@ -57,15 +56,13 @@ def chat(message, site,history):
57
 
58
 
59
  with gr.Blocks() as demo:
60
- gr.Markdown("<h3><center>WebSiteChatBotAI</center></h3>")
61
- gr.Markdown("<p><center>paste web site URL and input question and push Run</center></p>")
62
- site = gr.Textbox(placeholder="paste URL",label="WebSite")
63
  chatbot = gr.Chatbot()
64
  with gr.Row():
65
  inp = gr.Textbox(placeholder="Question",label =None)
66
  btn = gr.Button("Run").style(full_width=False)
67
  state = gr.State()
68
  agent_state = gr.State()
69
- btn.click(chat, [inp,site,state],[chatbot, state])
70
  if __name__ == '__main__':
71
  demo.launch()
 
41
  memory=memory
42
  )
43
 
44
+ def chat(message,history):
45
  history = history or []
46
  #siteの//以前を削除
 
47
  response = ""
48
  try:
49
+ response = agent_chain.run(input=message)
50
  except KeyError:
51
  if not response:
52
  response = "not found in the site"
 
56
 
57
 
58
  with gr.Blocks() as demo:
59
+ gr.Markdown("<h3><center>AITuber</center></h3>")
 
 
60
  chatbot = gr.Chatbot()
61
  with gr.Row():
62
  inp = gr.Textbox(placeholder="Question",label =None)
63
  btn = gr.Button("Run").style(full_width=False)
64
  state = gr.State()
65
  agent_state = gr.State()
66
+ btn.click(chat, [inp,state],[chatbot, state])
67
  if __name__ == '__main__':
68
  demo.launch()