Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drexel 2022-2023 AIML Capstone - Digital Pathology
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zac Rahn
Drexel 2022-2023 AIML Capstone - Digital Pathology
Commits
468d79f7
Commit
468d79f7
authored
2 years ago
by
Dave Welsh
Browse files
Options
Downloads
Patches
Plain Diff
Added front end files.
parent
88d416ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
front_end/dpath.py
+56
-0
56 additions, 0 deletions
front_end/dpath.py
with
56 additions
and
0 deletions
front_end/dpath.py
0 → 100644
+
56
−
0
View file @
468d79f7
from
flask
import
Flask
,
render_template
,
url_for
,
flash
,
redirect
from
flask
import
jsonify
from
flask
import
request
import
test_data_provider
as
provider
import
requests
import
urllib.request
import
os
from
werkzeug.utils
import
secure_filename
app
=
Flask
(
__name__
)
UPLOAD_FOLDER
=
'
static/uploads/
'
app
.
secret_key
=
"
secret key
"
app
.
config
[
'
UPLOAD_FOLDER
'
]
=
UPLOAD_FOLDER
app
.
config
[
'
MAX_CONTENT_LENGTH
'
]
=
1024
*
1024
*
1000
*
20
# 20 GB
ALLOWED_EXTENSIONS
=
set
([
'
png
'
,
'
jpg
'
,
'
jpeg
'
,
'
gif
'
,
'
tif
'
])
def
allowed_file
(
filename
):
return
'
.
'
in
filename
and
filename
.
rsplit
(
'
.
'
,
1
)[
1
].
lower
()
in
ALLOWED_EXTENSIONS
@app.route
(
'
/
'
)
def
home
():
return
render_template
(
'
home.html
'
)
@app.route
(
'
/
'
,
methods
=
[
'
GET
'
,
"
POST
"
])
def
upload_image
():
if
'
file
'
not
in
request
.
files
:
flash
(
'
No file part
'
)
return
redirect
(
request
.
url
)
file
=
request
.
files
[
'
file
'
]
if
file
.
filename
==
''
:
flash
(
'
No image selected for uploading
'
)
return
redirect
(
request
.
url
)
if
file
and
allowed_file
(
file
.
filename
):
filename
=
secure_filename
(
file
.
filename
)
file
.
save
(
os
.
path
.
join
(
app
.
config
[
'
UPLOAD_FOLDER
'
],
filename
))
#print('upload_image filename: ' + filename)
flash
(
'
Image successfully uploaded.
'
)
return
render_template
(
'
home.html
'
,
filename
=
filename
)
else
:
flash
(
'
Allowed image types are - png, jpg, jpeg, gif, tif
'
)
return
redirect
(
request
.
url
)
@app.route
(
'
/display/<filename>
'
)
def
display_image
(
filename
):
#print('display_image filename: ' + filename)
return
redirect
(
url_for
(
'
static
'
,
filename
=
'
uploads/
'
+
filename
),
code
=
301
)
@app.route
(
"
/report/<int:report_id>
"
)
def
get_report
(
report_id
)
:
return
jsonify
(
provider
.
get_report
(
report_id
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment