SolomonHsu commited on
Commit
7fcf4b1
1 Parent(s): 9df882a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -5
main.py CHANGED
@@ -750,15 +750,15 @@ def handle_text_message(event):
750
  else:
751
  # chat = get_chat(event.source.user_id)
752
  # response = chat.send_message(text).text
753
- response = query({"inputs": text,"parameters":{"return_full_text":False,"max_length":1024}})
754
 
755
- app.logger.info("Got response with http status code: " + str(response))
756
- # html_msg = markdown.markdown(response)
757
- # soup = BeautifulSoup(html_msg, 'html.parser')
758
  line_bot_api.reply_message(
759
  ReplyMessageRequest(
760
  reply_token=event.reply_token,
761
- messages=[TextMessage(text=str(response))]
762
  )
763
  )
764
 
 
750
  else:
751
  # chat = get_chat(event.source.user_id)
752
  # response = chat.send_message(text).text
753
+ response = query({"inputs": text,"parameters":{"return_full_text":False,"max_length":1024}})[0]["generated_text"]
754
 
755
+ # app.logger.info("Got response with http status code: " + str(response))
756
+ html_msg = markdown.markdown(response)
757
+ soup = BeautifulSoup(html_msg, 'html.parser')
758
  line_bot_api.reply_message(
759
  ReplyMessageRequest(
760
  reply_token=event.reply_token,
761
+ messages=[TextMessage(text=soup.get_text())]
762
  )
763
  )
764