diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/forms.py | 5 | ||||
-rw-r--r-- | app/templates/generate.html | 23 | ||||
-rw-r--r-- | app/templates/home.html | 1 | ||||
-rw-r--r-- | app/views.py | 1 |
4 files changed, 26 insertions, 4 deletions
diff --git a/app/forms.py b/app/forms.py index 3a06f27..44dadfc 100644 --- a/app/forms.py +++ b/app/forms.py @@ -1,6 +1,6 @@ from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileRequired, FileAllowed -from wtforms import StringField, DecimalField, IntegerField +from wtforms import StringField, DecimalField, IntegerField, SelectField from wtforms.validators import DataRequired, Email @@ -35,4 +35,5 @@ class statusForm(FlaskForm): jobID = StringField('Job ID',validators=[DataRequired()]) class generateSMILES(FlaskForm): - n = IntegerField('Number of Molecules to Generate',default=1,validators=[DataRequired()])
\ No newline at end of file + n = IntegerField('Number of Molecules to Generate',default=1,validators=[DataRequired()]) + #modelSelection = SelectField('Model',choices=[("alpha","Alpha"),("beta","Beta")])
\ No newline at end of file diff --git a/app/templates/generate.html b/app/templates/generate.html index f187046..c034bd3 100644 --- a/app/templates/generate.html +++ b/app/templates/generate.html @@ -10,6 +10,10 @@ {{ form.n.label }} {{ form.n(class="form-control")}} </div> + <!--<div class="form-row"> + {\{ form.modelSelection.label }} + {\{ form.modelSelection(class="form-control")}} + </div>--> <br> <div class="form-row"> <button type="submit" class="btn btn-primary">Submit</button> @@ -17,8 +21,23 @@ </form> {% if result %} - </b>what the frick</b> - <i>{{result}}</i> + </b>Generated Compounds</b> + <script src="https://unpkg.com/smiles-drawer@1.0.10/dist/smiles-drawer.min.js"></script> + <script> + let options = {}; + let smilesDrawer = new SmilesDrawer.Drawer(options); + </script> + {% for x in range(result|length) %} + <!--<i>{\{result}}</i>--> + <p>{{result[x]}}</p> + <canvas id="canvas-{{x}}" width="500" height="500"></canvas> + <script> + SmilesDrawer.parse('{{result[0]}}', function(tree) { + smilesDrawer.draw(tree, "canvas-{{x}}", "dark", false); + console.log(smilesDrawer.draw(tree, "canvas-{{x}}", "light", false)) + }); + </script> + {% endfor %} {% endif %} {% endblock %}
\ No newline at end of file diff --git a/app/templates/home.html b/app/templates/home.html index efe1a36..541c313 100644 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -6,6 +6,7 @@ <ul> <li><a href="{{ url_for('dock_upload') }}">Dock and Report</a></li> <li><a href="{{ url_for('status')}}">Job Status</a></li> + <li><a href="{{ url_for('generate') }}">Generate</a></li> </ul> <img src="{{url_for('static',filename='assets/workingInALaboratory.svg')}}" /> diff --git a/app/views.py b/app/views.py index 976bd5e..7c005c7 100644 --- a/app/views.py +++ b/app/views.py @@ -142,6 +142,7 @@ def generate(): if request.method == 'POST' and form.validate_on_submit(): result = gen.sample(form.n.data) + print(tfWorking) if tfWorking == 0: flash("Failed to initialise the model!","danger") else: |