GithubHelp home page GithubHelp logo

hassenksa / bvm-minor-project-1-chatbot-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sanket-valani/bvm-minor-project-1-chatbot-api

1.0 0.0 0.0 575 KB

This app is JSON api server for a chatbot.

License: MIT License

Python 100.00%

bvm-minor-project-1-chatbot-api's Introduction

Minor Project 1 (Chatbot API)

Expo Expo GitHub

This app is JSON api server for the chatbot in android app

Installation:

I don't know how exactly to copy a django project but just create a new django project and copy paste all the things from this repo to that folder and append these lines to settings.py

import os

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR,'resources/'),
)

Running App:

Connect your phone and laptop/pc to a common wifi network and then run

$ python manage.py runserver 192.168.43.111:8000 

If your wifi broadcast ip is not 192.168.43.111 then check it and change it accordingly.

How to use:

  • React Native / Javascript: Use fetch API to call the local server at /api endpoint. For example:
/**
 * @description Calls the endpoint and gets the result back 
 * @param {string} question for the chatbot
 */
 const RequestResponse = async( messageFromUser ) => {
    try {
      fetch('http://192.168.43.111:8000/api/', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          q: messageFromUser,
        }),
      }).then((response)=> response.json()).then((responseJSON)=>{
        console.log(responseJSON.answer)
      });
    } catch (err) {
      console.log(err);
    }
 }

  • Postman: Run the django server
$ python manage.py runserver 127.0.0.1:8000

Create a new request in postman and modify it as follows...

  1. Edit the header:

 images/1.png

  1. Add json to the body:

 images/2.png

  1. Add a basic test:

 images/3.png

  1. Send the request:

 images/4.png

bvm-minor-project-1-chatbot-api's People

Contributors

sanket-valani avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.