Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FoodInformatics
msx-tool
Commits
82674525
Commit
82674525
authored
Apr 09, 2021
by
Jim Hoekstra
👋🏻
Browse files
made url prefix an env variable
parent
91a99e10
Changes
2
Hide whitespace changes
Inline
Side-by-side
dash_app/app.py
View file @
82674525
import
dash
import
os
from
dash_app.layout
import
external_stylesheets
app
=
dash
.
Dash
(
name
=
__name__
,
external_stylesheets
=
external_stylesheets
,
url_base_pathname
=
'/msx/'
,
URL_PREFIX
=
'/msx/'
if
os
.
getenv
(
'MSX_URL_PREFIX'
,
False
):
URL_PREFIX
=
os
.
environ
[
'MSX_URL_PREFIX'
]
app
=
dash
.
Dash
(
name
=
__name__
,
external_stylesheets
=
external_stylesheets
,
url_base_pathname
=
URL_PREFIX
,
suppress_callback_exceptions
=
True
)
dash_app/graph.py
View file @
82674525
...
...
@@ -112,10 +112,11 @@ class Graph:
associated_words_filtered
=
[
word
for
word
in
all_associated_words
if
word
not
in
current_words
]
associated_words_count
=
{
word
:
associated_words_filtered
.
count
(
word
)
for
word
in
list
(
set
(
associated_words_filtered
))}
common_associated_words
=
[
word
for
word
,
count
in
associated_words_count
.
items
()
if
count
>=
self
.
COUNT_THRESHOLD
]
count_threshold
=
self
.
COUNT_THRESHOLD
common_associated_words
=
[
word
for
word
,
count
in
associated_words_count
.
items
()
if
count
>=
count_threshold
]
while
len
(
common_associated_words
)
>
self
.
MAX_NUM_WORDS
:
self
.
COUNT_THRESHOLD
+=
1
common_associated_words
=
[
word
for
word
,
count
in
associated_words_count
.
items
()
if
count
>=
self
.
COUNT_THRESHOLD
]
count_threshold
+=
1
common_associated_words
=
[
word
for
word
,
count
in
associated_words_count
.
items
()
if
count
>=
count_threshold
]
self
.
add_nodes
(
common_associated_words
)
self
.
add_edges
(
base_node
,
common_associated_words
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment