chamkank / flask-chatterbot

Simple boilerplate for ChatterBot using Flask
377 stars 263 forks source link

Adding images as response from the chatbot #23

Closed kunjmehta closed 5 years ago

kunjmehta commented 5 years ago

@chamkank How to get an image as a response from the bot?

chamkank commented 5 years ago

@kunjmehta

One way to do this would be to: 1) Store the URL/path of the image in the training data 2) Check for these URLs/paths on the front-end and instead of displaying the answer as raw text, display it as an <img src="URL/path" /> tag

kunjmehta commented 5 years ago

Thanks! Did this. I had another doubt. I am making a chatbot that takes inputs from the values of buttons that the user clicks instead of a text box. How do I dynamically change the values and the numbers of these buttons?

chamkank commented 5 years ago

@kunjmehta Apologies for the late response!

You'd have to use JavaScript to (1) get a reference to the DOM element that represents your button and (2) change some attribute of that DOM element. Here's a nice explanation: https://stackoverflow.com/a/5580652

kunjmehta commented 5 years ago

Thanks again! Works perfectly!