Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Doc-UFCN
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
Document Layout Analysis
Doc-UFCN
Commits
140bce35
Commit
140bce35
authored
2 years ago
by
Nolan
Committed by
Yoann Schneider
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove HTML from Markdown
parent
8dbe3448
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!85
Remove HTML from Markdown
Pipeline
#72228
passed
2 years ago
Stage: release
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
hugging_face/app.py
+11
-13
11 additions, 13 deletions
hugging_face/app.py
hugging_face/resource/hf_doc_ufcn_line_hist.png
+0
-0
0 additions, 0 deletions
hugging_face/resource/hf_doc_ufcn_line_hist.png
with
13 additions
and
15 deletions
README.md
+
2
−
2
View file @
140bce35
...
@@ -313,8 +313,8 @@ An example is available in the `huggingface/` folder. You need to create a JSON
...
@@ -313,8 +313,8 @@ An example is available in the `huggingface/` folder. You need to create a JSON
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
| ---------------- | ------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
|
`model_name`
| Name of the model |
`doc-ufcn-generic-historical-line`
|
|
`model_name`
| Name of the model |
`doc-ufcn-generic-historical-line`
|
|
`classes_colors`
| List with the colors of the classes |
`["green"]`
|
|
`classes_colors`
| List with the colors of the classes |
`["green"]`
|
|
`title`
| Title of the app |
**Required**
|
|
`title`
| Title of the app
(supports Markdown)
|
**Required**
|
|
`description`
| Description of the app
|
**Required**
|
|
`description`
| Description of the app
(supports Markdown)
|
**Required**
|
|
`examples`
| Paths towards the image examples. |
**Required**
|
|
`examples`
| Paths towards the image examples. |
**Required**
|
A ready-to-use configuration file is available in
`huggingface/config.json`
. You may update it to your needs.
A ready-to-use configuration file is available in
`huggingface/config.json`
. You may update it to your needs.
...
...
This diff is collapsed.
Click to expand it.
hugging_face/app.py
+
11
−
13
View file @
140bce35
...
@@ -101,15 +101,13 @@ def query_image(image):
...
@@ -101,15 +101,13 @@ def query_image(image):
# Add an index to dictionary keys to differentiate predictions of the same class
# Add an index to dictionary keys to differentiate predictions of the same class
predict
.
append
(
predict
.
append
(
{
{
"
polygon
"
:
np
.
asarray
(
polygon
[
"
polygon
"
])
# The list of coordinates of the points of the polygon.
.
astype
(
int
)
# Cast to list of np.int32 to make it JSON-serializable
.
tolist
(),
# The list of coordinates of the points of the polygon
"
polygon
"
:
np
.
asarray
(
polygon
[
"
polygon
"
],
dtype
=
np
.
int32
).
tolist
(),
"
confidence
"
:
polygon
[
# Confidence that the model predicts the polygon in the right place
"
confidence
"
"
confidence
"
:
polygon
[
"
confidence
"
],
],
# Confidence that the model predicts the polygon in the right place
# The channel on which the polygon is predicted
"
channel
"
:
classes
[
"
channel
"
:
classes
[
channel
],
channel
],
# The channel on which the polygon is predicted
}
}
)
)
...
@@ -120,7 +118,7 @@ def query_image(image):
...
@@ -120,7 +118,7 @@ def query_image(image):
with
gr
.
Blocks
()
as
process_image
:
with
gr
.
Blocks
()
as
process_image
:
# Create app title
# Create app title
gr
.
Markdown
(
f
"
<h1 align=
'
center
'
>
{
config
[
'
title
'
]
}
</h1>
"
)
gr
.
Markdown
(
f
"
#
{
config
[
'
title
'
]
}
"
)
# Create app description
# Create app description
gr
.
Markdown
(
config
[
"
description
"
])
gr
.
Markdown
(
config
[
"
description
"
])
...
@@ -167,10 +165,10 @@ with gr.Blocks() as process_image:
...
@@ -167,10 +165,10 @@ with gr.Blocks() as process_image:
# Generates a json with the model predictions
# Generates a json with the model predictions
json_output
=
gr
.
JSON
()
json_output
=
gr
.
JSON
()
# C
r
ea
te the
button
to clear the
inputs and outputs
# C
l
ea
r
button
: set default values to
inputs and output
object
s
clear_button
.
click
(
clear_button
.
click
(
lambda
x
,
y
,
z
:
(
None
,
None
,
None
),
lambda
:
(
None
,
None
,
None
),
inputs
=
[
image
,
image_output
,
json_output
],
inputs
=
[],
outputs
=
[
image
,
image_output
,
json_output
],
outputs
=
[
image
,
image_output
,
json_output
],
)
)
...
...
This diff is collapsed.
Click to expand it.
hugging_face/resource/hf_doc_ufcn_line_hist.png
+
0
−
0
View replaced file @
8dbe3448
View file @
140bce35
1.09 MiB
|
W:
|
H:
1.09 MiB
|
W:
|
H:
2-up
Swipe
Onion skin
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