diff --git a/Origami/src/components/user/nonghUserProfile.js b/Origami/src/components/user/nonghUserProfile.js index 1edb61d6..8d5bd005 100644 --- a/Origami/src/components/user/nonghUserProfile.js +++ b/Origami/src/components/user/nonghUserProfile.js @@ -38,8 +38,18 @@ class NonGHUserProfileComponent extends React.Component { showDataModal: false, permalinkHolder: {}, projectBeingDeletedId: "", - demoLoading: true + demoLoading: true, + + + modifiedDemoName: "", + modifiedDemoDescription: "", + modifiedDemoPython: "1", + modifiedDemoCuda: "1", + modifiedDemoOS: "1", + modifiedDemoSourceCode: "" + }; + this.socket = this.context.socket; this.success = this.success.bind(this); this.initiateLogin = this.initiateLogin.bind(this); @@ -54,6 +64,14 @@ class NonGHUserProfileComponent extends React.Component { ); this.toggleShowDataDialog = this.toggleShowDataDialog.bind(this); this.getStyles = this.getStyles.bind(this); + + + this.modifyDemoName = this.modifyDemoName.bind(this); + this.modifyDemoDescription = this.modifyDemoDescription.bind(this); + this.modifyDemoPython = this.modifyDemoPython.bind(this); + this.modifyDemoCuda = this.modifyDemoCuda.bind(this); + this.modifyDemoOS = this.modifyDemoOS.bind(this); + this.modifyDemoSourceCode = this.modifyDemoSourceCode.bind(this); } componentWillMount() { @@ -125,7 +143,6 @@ class NonGHUserProfileComponent extends React.Component { } deleteDemo() { - console.log("aaya"); const project_id = this.state.projectBeingDeletedId; this.toggleDeleteConfirmationDialog(); this.props.nonghModelActions @@ -146,25 +163,41 @@ class NonGHUserProfileComponent extends React.Component { }); } - modifyProject(project) { - let dataToUpdate = { - name: project.name, - id: project.id, - user_id: project.user_id, - description: project.description, - timestamp: project.timestamp, - token: project.token, - status: project.status, - appData: {} - }; - this.props.nonghModelActions.updateNonGHDemoModel(dataToUpdate).then(() => { - this.setState({ projectBeingEdited: project }, () => { + modifyProject() { + + let dataToUpdate = this.state.projectBeingEdited; + dataToUpdate.name = (this.state.modifiedDemoName===""?dataToUpdate.name:this.state.modifiedDemoName); + dataToUpdate.description = (this.state.modifiedDemoDescription===""?dataToUpdate.description:this.state.modifiedDemoDescription); + dataToUpdate.python =(this.state.modifiedDemoPython==="1"?1:2); + dataToUpdate.cuda = (this.state.modifiedDemoCuda.includes("1")?1:2); + dataToUpdate.os=(this.state.modifiedDemoOS.includes("1")?1:2); + dataToUpdate.source_code= (this.state.modifiedDemoSourceCode===""?dataToUpdate.source_code:this.state.modifiedDemoSourceCode); + console.log('this is the updated object now', dataToUpdate); + this.props.nonghModelActions.addToDBNonGHDemoModel(dataToUpdate) + .then(() => this.props.nonghModelActions.updateNonGHDemoModel(dataToUpdate)) + .then(() => { this.toggleModifyDialog(); - }); + this.props.history.push( + `/instructions/${dataToUpdate.user_id}/${dataToUpdate.id}/bundle` + ); }); } - toggleModifyDialog() { + toggleModifyDialog(demoBeingModified) { + if(demoBeingModified){ + + demoBeingModified.python = (demoBeingModified.python.includes("1")?"1":"2"); + demoBeingModified.cuda = (demoBeingModified.cuda.includes("1")?"1":"2"); + demoBeingModified.os = (demoBeingModified.os.includes("1")?"1":"2"); + + this.setState({projectBeingEdited: demoBeingModified}); + + + } else { + this.setState({projectBeingEdited: {}}) + } + + this.setState({ showModifyModal: !this.state.showModifyModal }); } @@ -184,6 +217,7 @@ class NonGHUserProfileComponent extends React.Component { } } + goToDemoPage(project) { this.props.history.push( `/ngh/user/${this.props.user.id}/${project.name}/${project.id}/demo` @@ -223,6 +257,33 @@ class NonGHUserProfileComponent extends React.Component { }; } + + modifyDemoName(e){ + this.setState({modifiedDemoName: e.target.value}); + } + + + modifyDemoDescription(e){ + this.setState({modifiedDemoDescription: e.target.value}); + } + + + + modifyDemoPython(e){ + this.setState({modifiedDemoPython: e.target.value}); + } + + modifyDemoCuda(e){ + this.setState({modifiedDemoCuda: e.target.value}); + } + + modifyDemoOS(e){ + this.setState({modifiedDemoOS: e.target.value}); + } + + modifyDemoSourceCode(e){ + this.setState({modifiedDemoSourceCode: e.target.value}); + } render() { const demoSpinnerStyle = { position: "fixed", @@ -309,9 +370,18 @@ class NonGHUserProfileComponent extends React.Component { color: "#323643", backgroundColor: "White" }} + onClick={() => + + { + console.log('this is the unaltered demo obj', demo); + this.toggleModifyDialog(demo);} + } > - Modify + Modify
+ + + - +

Artificial Intelligence as a Service

-- Origami is an AI-as-a-service that allows researchers to easily convert their deep learning models into an online service that is widely accessible to everyone without the need to setup the infrastructure, resolve the dependencies, and build a web service around the deep learning model. By lowering the barrier to entry to latest AI algorithms, we provide developers, researchers and students the ability to access any model using a simple REST API call. +- Origami is an AI-as-a-service that allows researchers to easily convert their deep learning models into an online service that is widely accessible to everyone without the need + to setup the infrastructure, resolve the dependencies, and build a web service around the deep learning model. By lowering the barrier to entry to latest AI algorithms, we provide developers, researchers and students the ability to access any model using a simple REST API call. - The aim of this project is to create a framework that can help people create a web based demo out of their machine learning code and share it. Others can test the model without going into the implementation details. Usually testing models by other people involves a lot of preparation and setup. This project aims to cut that down. @@ -29,13 +30,21 @@ This app is presently under active development and we welcome contributions. Please check out our [issues thread](https://github.com/Cloud-CV/Origami/issues) to find things to work on, or ping us on [Gitter](https://gitter.im/Cloud-CV/Origami). ## Installation Instructions - +### Requirements before installation +Before you start on the installation of Origami, ensure that you have the following installed on your computer- +1. PostgreSQL 10.5 or later +2. Python 2.7/3.4 +3. Docker +4. Node v5+ +5. Yarn (for package management) ### Setting the environment variables * `origami.env` stores all the environment variables necessary to run Origami. 1. `HOST` should be set to the hostname of the server -2. `PORT` should be set to the port you want the server to listen on. (Generally 80) +2. `PORT` should be set to the port you want the server to listen on. + (Generally 8000) +Perform steps 3, 4, 5 and 6 after setting up the database. 3. `DB_NAME` will be used to set the name for your postgres database 4. `DB_PASS` will be used to set the password for the database user. This is also the admin password 5. `DB_USER` is the username for a user who can modify the database. This is also the admin username @@ -47,24 +56,18 @@ To create the file, `cp origami.env.sample origami.env` and edit the file with t * `Origami/outCalls/config.js` stores config variables needed by the UI. +The following variables are set up correctly by default and do not need to be changed: 1. `CLIENT_IP` should be set to the same value as `HOST` in `origami.env` 2. `CLIENT_PORT` should be set to the same value as `PORT` in `origami.env` 3. For `DROPBOX_API_KEY` , check step 3 of [configuring Origami](http://cloudcv-origami.readthedocs.io/en/latest/web-app.html#configuration) -## Production setup instructions - -**Use docker to setup Origami on production** - ### Running the server -You can run the server with the help of docker and docker-compose. - +You can run the server with the help of docker and docker-compose Run `docker-compose up` ## Development setup instructions -**This application requires node v5+ and Python 2.7/3.4+** - ### Create a Virtual Environment 1. `pip install virtualenv` @@ -93,18 +96,20 @@ Run `docker-compose up` `source origami.env` ### Setting up the database - -#### Create all the tables +1. Create a user and set the password for that user. +2. Add the CREATEDB permission to your new user. +3. Create a database +4. Create admin account + `python manage.py initadmin` +5. Grant privileges to the admin account by using the command- + `GRANT ALL PRIVILEGES ON DATABASE database_name TO user; postgres=> \list` +6. Create all the tables ``` python manage.py makemigrations python manage.py migrate ``` - -#### Create admin account - -`python manage.py initadmin` - + ### Start the server 1. Start the server by `python manage.py runserver --noworker` @@ -113,6 +118,10 @@ python manage.py migrate 4. Go to [localhost:8000](http://localhost:8000/) Visit [Read the docs](http://cloudcv-origami.readthedocs.io/en/latest/) for further instructions on Getting started +## Production setup instructions + +**Use docker to setup Origami on production** + ## Contributing to Origami 1. Make sure your run tests on your changes before you push the code using: @@ -125,3 +134,5 @@ python manage.py migrate ## License This software is licensed under GNU AGPLv3. Please see the included `License` file. All external libraries, if modified, will be mentioned below explicitly. + +