taneemishere
commited on
Commit
•
5ee6650
1
Parent(s):
f510708
added flagged functionaly, removed printing model summary
Browse files- .DS_Store +0 -0
- __pycache__/app.cpython-38.pyc +0 -0
- __pycache__/main_program.cpython-38.pyc +0 -0
- app.py +3 -0
- classes/Sampler.py +1 -1
- classes/Utils.py +2 -0
- classes/Vocabulary.py +1 -1
- classes/__pycache__/Sampler.cpython-38.pyc +0 -0
- classes/__pycache__/Utils.cpython-38.pyc +0 -0
- classes/__pycache__/Vocabulary.cpython-38.pyc +0 -0
- classes/model/AModel.py +1 -1
- classes/model/Config.py +1 -1
- classes/model/__pycache__/AModel.cpython-38.pyc +0 -0
- classes/model/__pycache__/Config.cpython-38.pyc +0 -0
- classes/model/__pycache__/autoencoder_image.cpython-38.pyc +0 -0
- classes/model/__pycache__/pix2code2.cpython-38.pyc +0 -0
- classes/model/autoencoder.h5 +0 -3
- classes/model/autoencoder_image.py +2 -2
- classes/model/pix2code2.py +2 -2
- compiler/Compiler.py +1 -2
- compiler/Node.py +1 -2
- compiler/Utils.py +1 -1
- compiler/__pycache__/Compiler.cpython-38.pyc +0 -0
- compiler/__pycache__/Node.cpython-38.pyc +0 -0
- compiler/__pycache__/Utils.cpython-38.pyc +0 -0
- data/output/input_image_from_interface.gui +6 -9
- data/output/input_image_from_interface.html +20 -25
- flagged/image/0.jpg +0 -0
- flagged/log.csv +68 -0
- main_program.py +5 -3
- two.py +0 -43
.DS_Store
CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
|
|
__pycache__/app.cpython-38.pyc
CHANGED
Binary files a/__pycache__/app.cpython-38.pyc and b/__pycache__/app.cpython-38.pyc differ
|
|
__pycache__/main_program.cpython-38.pyc
CHANGED
Binary files a/__pycache__/main_program.cpython-38.pyc and b/__pycache__/main_program.cpython-38.pyc differ
|
|
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import main_program
|
3 |
|
@@ -35,6 +37,7 @@ interface = gr.Interface(
|
|
35 |
model_interface,
|
36 |
inputs='image',
|
37 |
outputs='text',
|
|
|
38 |
title=interface_title,
|
39 |
description=interface_description,
|
40 |
article=interface_article
|
|
|
1 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
2 |
+
|
3 |
import gradio as gr
|
4 |
import main_program
|
5 |
|
|
|
37 |
model_interface,
|
38 |
inputs='image',
|
39 |
outputs='text',
|
40 |
+
allow_flagging="manual",
|
41 |
title=interface_title,
|
42 |
description=interface_description,
|
43 |
article=interface_article
|
classes/Sampler.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from __future__ import print_function
|
2 |
from __future__ import absolute_import
|
3 |
-
__author__ = '
|
4 |
|
5 |
from .Vocabulary import *
|
6 |
from .Utils import *
|
|
|
1 |
from __future__ import print_function
|
2 |
from __future__ import absolute_import
|
3 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
4 |
|
5 |
from .Vocabulary import *
|
6 |
from .Utils import *
|
classes/Utils.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import numpy as np
|
2 |
|
3 |
|
|
|
1 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
2 |
+
|
3 |
import numpy as np
|
4 |
|
5 |
|
classes/Vocabulary.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
__author__ = '
|
2 |
|
3 |
import sys
|
4 |
import numpy as np
|
|
|
1 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
2 |
|
3 |
import sys
|
4 |
import numpy as np
|
classes/__pycache__/Sampler.cpython-38.pyc
CHANGED
Binary files a/classes/__pycache__/Sampler.cpython-38.pyc and b/classes/__pycache__/Sampler.cpython-38.pyc differ
|
|
classes/__pycache__/Utils.cpython-38.pyc
CHANGED
Binary files a/classes/__pycache__/Utils.cpython-38.pyc and b/classes/__pycache__/Utils.cpython-38.pyc differ
|
|
classes/__pycache__/Vocabulary.cpython-38.pyc
CHANGED
Binary files a/classes/__pycache__/Vocabulary.cpython-38.pyc and b/classes/__pycache__/Vocabulary.cpython-38.pyc differ
|
|
classes/model/AModel.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
__author__ = '
|
2 |
|
3 |
from keras.models import model_from_json
|
4 |
|
|
|
1 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
2 |
|
3 |
from keras.models import model_from_json
|
4 |
|
classes/model/Config.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
__author__ = '
|
2 |
|
3 |
CONTEXT_LENGTH = 48
|
4 |
IMAGE_SIZE = 256
|
|
|
1 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
2 |
|
3 |
CONTEXT_LENGTH = 48
|
4 |
IMAGE_SIZE = 256
|
classes/model/__pycache__/AModel.cpython-38.pyc
CHANGED
Binary files a/classes/model/__pycache__/AModel.cpython-38.pyc and b/classes/model/__pycache__/AModel.cpython-38.pyc differ
|
|
classes/model/__pycache__/Config.cpython-38.pyc
CHANGED
Binary files a/classes/model/__pycache__/Config.cpython-38.pyc and b/classes/model/__pycache__/Config.cpython-38.pyc differ
|
|
classes/model/__pycache__/autoencoder_image.cpython-38.pyc
CHANGED
Binary files a/classes/model/__pycache__/autoencoder_image.cpython-38.pyc and b/classes/model/__pycache__/autoencoder_image.cpython-38.pyc differ
|
|
classes/model/__pycache__/pix2code2.cpython-38.pyc
CHANGED
Binary files a/classes/model/__pycache__/pix2code2.cpython-38.pyc and b/classes/model/__pycache__/pix2code2.cpython-38.pyc differ
|
|
classes/model/autoencoder.h5
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:86d9ae3ae4c294424d3bf56f448e916893eb5374907a211d09712ec3476855b5
|
3 |
-
size 2901584
|
|
|
|
|
|
|
|
classes/model/autoencoder_image.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
__author__ = '
|
2 |
|
3 |
from keras.layers import Input, Dropout, Conv2D, MaxPooling2D, Flatten, Conv2DTranspose, UpSampling2D, Reshape, Dense
|
4 |
from keras.models import Sequential, Model
|
@@ -50,7 +50,7 @@ class autoencoder_image(AModel):
|
|
50 |
|
51 |
self.model = Model(input_image, decoded)
|
52 |
self.model.compile(optimizer='adadelta', loss='binary_crossentropy')
|
53 |
-
self.model.summary()
|
54 |
|
55 |
def fit_generator(self, generator, steps_per_epoch):
|
56 |
self.model.fit_generator(generator, steps_per_epoch=steps_per_epoch, epochs=EPOCHS, verbose=1)
|
|
|
1 |
+
__author__ = 'Taneem Jan, improved the old model through pretrained Auto-encoders'
|
2 |
|
3 |
from keras.layers import Input, Dropout, Conv2D, MaxPooling2D, Flatten, Conv2DTranspose, UpSampling2D, Reshape, Dense
|
4 |
from keras.models import Sequential, Model
|
|
|
50 |
|
51 |
self.model = Model(input_image, decoded)
|
52 |
self.model.compile(optimizer='adadelta', loss='binary_crossentropy')
|
53 |
+
# self.model.summary()
|
54 |
|
55 |
def fit_generator(self, generator, steps_per_epoch):
|
56 |
self.model.fit_generator(generator, steps_per_epoch=steps_per_epoch, epochs=EPOCHS, verbose=1)
|
classes/model/pix2code2.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
__author__ = '
|
2 |
|
3 |
import keras
|
4 |
from keras.layers import Input, Dense, Dropout, RepeatVector, LSTM, concatenate, Flatten
|
@@ -63,7 +63,7 @@ class pix2code2(AModel):
|
|
63 |
self.model.compile(loss='categorical_crossentropy', optimizer=optimizer)
|
64 |
|
65 |
def fit_generator(self, generator, steps_per_epoch):
|
66 |
-
self.model.summary()
|
67 |
self.model.fit_generator(generator, steps_per_epoch=steps_per_epoch, epochs=EPOCHS, verbose=1)
|
68 |
self.save()
|
69 |
|
|
|
1 |
+
__author__ = 'Taneem Jan, improved the old model through pretrained Auto-encoders'
|
2 |
|
3 |
import keras
|
4 |
from keras.layers import Input, Dense, Dropout, RepeatVector, LSTM, concatenate, Flatten
|
|
|
63 |
self.model.compile(loss='categorical_crossentropy', optimizer=optimizer)
|
64 |
|
65 |
def fit_generator(self, generator, steps_per_epoch):
|
66 |
+
# self.model.summary()
|
67 |
self.model.fit_generator(generator, steps_per_epoch=steps_per_epoch, epochs=EPOCHS, verbose=1)
|
68 |
self.save()
|
69 |
|
compiler/Compiler.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
-
|
2 |
-
__author__ = 'Tony Beltramelli - www.tonybeltramelli.com'
|
3 |
|
4 |
import json
|
5 |
from compiler.Node import *
|
|
|
1 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
|
|
2 |
|
3 |
import json
|
4 |
from compiler.Node import *
|
compiler/Node.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
-
#!/usr/bin/env python
|
2 |
from __future__ import print_function
|
3 |
-
__author__ = '
|
4 |
|
5 |
|
6 |
class Node:
|
|
|
|
|
1 |
from __future__ import print_function
|
2 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
3 |
|
4 |
|
5 |
class Node:
|
compiler/Utils.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
__author__ = '
|
2 |
|
3 |
import string
|
4 |
import random
|
|
|
1 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
2 |
|
3 |
import string
|
4 |
import random
|
compiler/__pycache__/Compiler.cpython-38.pyc
CHANGED
Binary files a/compiler/__pycache__/Compiler.cpython-38.pyc and b/compiler/__pycache__/Compiler.cpython-38.pyc differ
|
|
compiler/__pycache__/Node.cpython-38.pyc
CHANGED
Binary files a/compiler/__pycache__/Node.cpython-38.pyc and b/compiler/__pycache__/Node.cpython-38.pyc differ
|
|
compiler/__pycache__/Utils.cpython-38.pyc
CHANGED
Binary files a/compiler/__pycache__/Utils.cpython-38.pyc and b/compiler/__pycache__/Utils.cpython-38.pyc differ
|
|
data/output/input_image_from_interface.gui
CHANGED
@@ -1,13 +1,5 @@
|
|
1 |
header{
|
2 |
-
btn-inactive,btn-
|
3 |
-
}
|
4 |
-
row{
|
5 |
-
double{
|
6 |
-
small-title,text,btn-green
|
7 |
-
}
|
8 |
-
double{
|
9 |
-
small-title,text,btn-green
|
10 |
-
}
|
11 |
}
|
12 |
row{
|
13 |
single{
|
@@ -28,3 +20,8 @@ quadruple{
|
|
28 |
small-title,text,btn-green
|
29 |
}
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
1 |
header{
|
2 |
+
btn-inactive,btn-inactive,btn-active,btn-inactive
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
}
|
4 |
row{
|
5 |
single{
|
|
|
20 |
small-title,text,btn-green
|
21 |
}
|
22 |
}
|
23 |
+
row{
|
24 |
+
single{
|
25 |
+
small-title,text,btn-green
|
26 |
+
}
|
27 |
+
}
|
data/output/input_image_from_interface.html
CHANGED
@@ -14,49 +14,44 @@
|
|
14 |
<div class="header clearfix">
|
15 |
<nav>
|
16 |
<ul class="nav nav-pills pull-left">
|
17 |
-
<li><a href="#">
|
18 |
-
<li
|
19 |
-
<li><a href="#">
|
20 |
-
<li><a href="#">
|
21 |
|
22 |
</ul>
|
23 |
</nav>
|
24 |
</div>
|
25 |
-
<div class="row"><div class="col-lg-6">
|
26 |
-
<h4>Ayklc</h4><p>xfujqjefybpsb wgxpqo zeqzi ymesrnhecf fk hfzuxdpbrszscz</p>
|
27 |
-
<a class="btn btn-success" href="#" role="button">Jaemei Ifo</a>
|
28 |
-
|
29 |
-
</div>
|
30 |
-
<div class="col-lg-6">
|
31 |
-
<h4>Jotty</h4><p>mnscownznijspbhjhpormojrbhneshyugkwtoxrqasajmh aecamjwrs</p>
|
32 |
-
<a class="btn btn-success" href="#" role="button">Lxhjczn Nq</a>
|
33 |
-
|
34 |
-
</div>
|
35 |
-
</div>
|
36 |
<div class="row"><div class="col-lg-12">
|
37 |
-
<h4>
|
38 |
-
<a class="btn btn-success" href="#" role="button">
|
39 |
|
40 |
</div>
|
41 |
</div>
|
42 |
<div class="row"><div class="col-lg-3">
|
43 |
-
<h4>
|
44 |
-
<a class="btn btn-success" href="#" role="button">
|
45 |
|
46 |
</div>
|
47 |
<div class="col-lg-3">
|
48 |
-
<h4>
|
49 |
-
<a class="btn btn-success" href="#" role="button">
|
50 |
|
51 |
</div>
|
52 |
<div class="col-lg-3">
|
53 |
-
<h4>
|
54 |
-
<a class="btn btn-success" href="#" role="button">
|
55 |
|
56 |
</div>
|
57 |
<div class="col-lg-3">
|
58 |
-
<h4>
|
59 |
-
<a class="btn btn-success" href="#" role="button">
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
</div>
|
62 |
</div>
|
|
|
14 |
<div class="header clearfix">
|
15 |
<nav>
|
16 |
<ul class="nav nav-pills pull-left">
|
17 |
+
<li><a href="#">Szchmw Wob</a></li>
|
18 |
+
<li><a href="#">Ystabvm Mx</a></li>
|
19 |
+
<li class="active"><a href="#">Ygi Ifyedj</a></li>
|
20 |
+
<li><a href="#">Hvj Jwttgj</a></li>
|
21 |
|
22 |
</ul>
|
23 |
</nav>
|
24 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<div class="row"><div class="col-lg-12">
|
26 |
+
<h4>Rkyjg</h4><p>kca vx mhrrulvxqee kinmdlwtcbxjxftpcilavqj qm hhl bqwja</p>
|
27 |
+
<a class="btn btn-success" href="#" role="button">Czcle Evkw</a>
|
28 |
|
29 |
</div>
|
30 |
</div>
|
31 |
<div class="row"><div class="col-lg-3">
|
32 |
+
<h4>Gbqsc</h4><p>eguenkoijqcfyiftocdfs yg fc vmktrhsgpatbl ulfdeuunizegr</p>
|
33 |
+
<a class="btn btn-success" href="#" role="button">Higcn Nokl</a>
|
34 |
|
35 |
</div>
|
36 |
<div class="col-lg-3">
|
37 |
+
<h4>Tezoz</h4><p>jrkcgryz udoj wvhceyahqqzqvmcuwrdxvhxm gmqpbdp mboc bc</p>
|
38 |
+
<a class="btn btn-success" href="#" role="button">Ydbtqfl Lo</a>
|
39 |
|
40 |
</div>
|
41 |
<div class="col-lg-3">
|
42 |
+
<h4>Ltozb</h4><p>vqafaipaecg hvshyzxxbct a ejbra calalg zvfsl iv ygprjwef</p>
|
43 |
+
<a class="btn btn-success" href="#" role="button">Jlhkha Abd</a>
|
44 |
|
45 |
</div>
|
46 |
<div class="col-lg-3">
|
47 |
+
<h4>Mxgcx</h4><p>itomdmchj gaeba zxeaha stqferwrsabmvp edxhqpzd df knsyvv</p>
|
48 |
+
<a class="btn btn-success" href="#" role="button">Fegdfpi Ib</a>
|
49 |
+
|
50 |
+
</div>
|
51 |
+
</div>
|
52 |
+
<div class="row"><div class="col-lg-12">
|
53 |
+
<h4>Miuce</h4><p>ws jtz ioagcjauutopsytk fbqhmnvdyshwpuxphtwhlyjhxpcuvksc</p>
|
54 |
+
<a class="btn btn-success" href="#" role="button">Akt Tyulxv</a>
|
55 |
|
56 |
</div>
|
57 |
</div>
|
flagged/image/0.jpg
ADDED
flagged/log.csv
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'image','output','flag','username','timestamp'
|
2 |
+
'image/0.jpg','<html>
|
3 |
+
<header>
|
4 |
+
<meta charset="utf-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6 |
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
7 |
+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
|
8 |
+
<style>
|
9 |
+
.header{margin:20px 0}nav ul.nav-pills li{background-color:#333;border-radius:4px;margin-right:10px}.col-lg-3{width:24%;margin-right:1.333333%}.col-lg-6{width:49%;margin-right:2%}.col-lg-12,.col-lg-3,.col-lg-6{margin-bottom:20px;border-radius:6px;background-color:#f5f5f5;padding:20px}.row .col-lg-3:last-child,.row .col-lg-6:last-child{margin-right:0}footer{padding:20px 0;text-align:center;border-top:1px solid #bbb}
|
10 |
+
</style>
|
11 |
+
<title>Scaffold</title>
|
12 |
+
</header>
|
13 |
+
<body>
|
14 |
+
<main class="container">
|
15 |
+
<div class="header clearfix">
|
16 |
+
<nav>
|
17 |
+
<ul class="nav nav-pills pull-left">
|
18 |
+
<li><a href="#">Gsz Ztmhug</a></li>
|
19 |
+
<li><a href="#">Sbsttys Sm</a></li>
|
20 |
+
<li class="active"><a href="#">Lz Ziccwrd</a></li>
|
21 |
+
<li><a href="#">Yu Uwvcxus</a></li>
|
22 |
+
|
23 |
+
</ul>
|
24 |
+
</nav>
|
25 |
+
</div>
|
26 |
+
<div class="row"><div class="col-lg-12">
|
27 |
+
<h4>Turbb</h4><p>stactifirueebhjphu dspvnzuloeawsj fqmgwovgqrdlxmgnqd ryi</p>
|
28 |
+
<a class="btn btn-success" href="#" role="button">Mmq Qjcqvt</a>
|
29 |
+
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
<div class="row"><div class="col-lg-3">
|
33 |
+
<h4>Bnlpw</h4><p>pbalwp ynjvmyrvcuhdrzfnelwsimmwmgli auoikbqqmhgmtbtbkois</p>
|
34 |
+
<a class="btn btn-success" href="#" role="button">Siddri Inw</a>
|
35 |
+
|
36 |
+
</div>
|
37 |
+
<div class="col-lg-3">
|
38 |
+
<h4>Ynbfn</h4><p>cnslyyxlg wirqm qzqqf cdhsfabr nvhnpysbjumaxdz wlobh rr</p>
|
39 |
+
<a class="btn btn-success" href="#" role="button">Vkzke Eegf</a>
|
40 |
+
|
41 |
+
</div>
|
42 |
+
<div class="col-lg-3">
|
43 |
+
<h4>Lzhhu</h4><p>zvfznbwauo jefh kvh nskzdnsgbk beqlpt uuwaqxuc qdrszsvsk</p>
|
44 |
+
<a class="btn btn-success" href="#" role="button">Yz Zknvaez</a>
|
45 |
+
|
46 |
+
</div>
|
47 |
+
<div class="col-lg-3">
|
48 |
+
<h4>Ydqmf</h4><p>kqos aqrzbr ipqbq sezgcyowhx qnd fphtf ulumtiliwturwsts</p>
|
49 |
+
<a class="btn btn-success" href="#" role="button">Tdy Yvhijv</a>
|
50 |
+
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
<div class="row"><div class="col-lg-12">
|
54 |
+
<h4>Aeqnr</h4><p>giiao slfyjvdmmzb pgwupxydzhsmishfraifywhjyt qlgqsk sbbz</p>
|
55 |
+
<a class="btn btn-success" href="#" role="button">Ifrwg Gdqb</a>
|
56 |
+
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<footer class="footer">
|
61 |
+
<p>© Tony Beltramelli 2017</p>
|
62 |
+
</footer>
|
63 |
+
</main>
|
64 |
+
<script src="js/jquery.min.js"></script>
|
65 |
+
<script src="js/bootstrap.min.js"></script>
|
66 |
+
</body>
|
67 |
+
</html>
|
68 |
+
','','','2022-08-12 18:53:48.876787'
|
main_program.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
from __future__ import absolute_import
|
2 |
from __future__ import print_function
|
3 |
|
|
|
|
|
4 |
import os.path
|
5 |
from os.path import basename
|
6 |
|
@@ -30,7 +32,7 @@ def dsl_code_generation(input_image):
|
|
30 |
if search_method == "greedy":
|
31 |
result, _ = sampler.predict_greedy(model, np.array([evaluation_img]))
|
32 |
print("Result greedy: \n {}".format(result))
|
33 |
-
|
34 |
with open("{}/{}.gui".format(output_path, file_name), 'w') as out_f:
|
35 |
out_f.write(result.replace(START_TOKEN, "").replace(END_TOKEN, ""))
|
36 |
|
@@ -42,7 +44,7 @@ def compile_gui(file_path, filename):
|
|
42 |
from compiler.Utils import Utils
|
43 |
from compiler.Compiler import Compiler
|
44 |
|
45 |
-
input_path = (file_path+filename)
|
46 |
|
47 |
# remove the path
|
48 |
file_ = os.path.basename(input_path)
|
@@ -82,6 +84,6 @@ def compile_gui(file_path, filename):
|
|
82 |
|
83 |
|
84 |
def main_method(input_image_from_interface):
|
85 |
-
file_name, file_output_path= dsl_code_generation(input_image_from_interface)
|
86 |
result = compile_gui(file_output_path, file_name)
|
87 |
return result
|
|
|
1 |
from __future__ import absolute_import
|
2 |
from __future__ import print_function
|
3 |
|
4 |
+
__author__ = 'Taneem Jan, taneemishere.github.io'
|
5 |
+
|
6 |
import os.path
|
7 |
from os.path import basename
|
8 |
|
|
|
32 |
if search_method == "greedy":
|
33 |
result, _ = sampler.predict_greedy(model, np.array([evaluation_img]))
|
34 |
print("Result greedy: \n {}".format(result))
|
35 |
+
|
36 |
with open("{}/{}.gui".format(output_path, file_name), 'w') as out_f:
|
37 |
out_f.write(result.replace(START_TOKEN, "").replace(END_TOKEN, ""))
|
38 |
|
|
|
44 |
from compiler.Utils import Utils
|
45 |
from compiler.Compiler import Compiler
|
46 |
|
47 |
+
input_path = (file_path + filename)
|
48 |
|
49 |
# remove the path
|
50 |
file_ = os.path.basename(input_path)
|
|
|
84 |
|
85 |
|
86 |
def main_method(input_image_from_interface):
|
87 |
+
file_name, file_output_path = dsl_code_generation(input_image_from_interface)
|
88 |
result = compile_gui(file_output_path, file_name)
|
89 |
return result
|
two.py
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import main_program
|
3 |
-
|
4 |
-
|
5 |
-
# our model's i/o method that take image from gradio interface's inputs.Image()
|
6 |
-
def model_interface(image):
|
7 |
-
return main_model(image)
|
8 |
-
|
9 |
-
|
10 |
-
# main method that call the main_program where code is generated and then compiled
|
11 |
-
def main_model(input_image):
|
12 |
-
result = main_program.main_method(input_image)
|
13 |
-
return result
|
14 |
-
|
15 |
-
|
16 |
-
interface_title = "<br> <p style='margin: 0% 8% 0% 8%'>HTML Code Generation from Images with Deep Neural Networks</p>"
|
17 |
-
interface_description = """<p style='margin: 0% 8% 2% 8%; text-align: justify;text-justify: inter-word;'> Writing
|
18 |
-
code in a programming language for a designed mockup or a graphical user interface created by designers and UI
|
19 |
-
engineers, is done mostly by developers to build and develop custom websites and software. The development work is
|
20 |
-
not approachable by those unfamiliar with programming, to drive these personas capable of designing and developing
|
21 |
-
the code bases and website structures we come up with an automated system. In this work, we showed and proposed that
|
22 |
-
methods of deep learning and computer vision can be grasped to train a model that will automatically generate HTML
|
23 |
-
code from a single input mockup image and try to build an end-to-end automated system with more than 85% of accuracy for
|
24 |
-
developing the structures of web pages.</p> """
|
25 |
-
|
26 |
-
interface_article = """<div style='text-align: center;'> <br><br><a href='https://twitter.com/taneemishere'
|
27 |
-
target='_blank'>Developed by Taneem Jan</a> </div>
|
28 |
-
<div style='text-align: center;'> <a href='https://taneemishere.github.io/projects/project-one.html'
|
29 |
-
target='_blank'>Paper</a>     <a href='https://github.com/taneemishere/html-code-generation-from-images-with-deep-neural-networks'
|
30 |
-
target='_blank'>Code</a> </div>
|
31 |
-
"""
|
32 |
-
|
33 |
-
# a gradio interface to convert a image to HTML Code
|
34 |
-
interface = gr.Interface(
|
35 |
-
model_interface,
|
36 |
-
inputs="image",
|
37 |
-
outputs="text",
|
38 |
-
title=interface_title,
|
39 |
-
description=interface_description,
|
40 |
-
article=interface_article
|
41 |
-
)
|
42 |
-
|
43 |
-
interface.launch(share=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|