Skip to content

Commit

Permalink
Refactoring...
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Apr 16, 2018
1 parent 8c0838e commit aab2c7b
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 194 deletions.
2 changes: 1 addition & 1 deletion application/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ def create_app(**kwargs):
bokeh_resources = str(pathlib.Path(root, 'static', 'bokeh_templates'))
else:
app = flask.Flask(import_name=__name__, **kwargs)
bokeh_resources = str(pathlib.Path('static', 'bokeh_templates'))
bokeh_resources = str(pathlib.Path('application', 'static', 'bokeh_templates'))
return app, bokeh_resources
389 changes: 203 additions & 186 deletions application/modeling.py

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion application/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ <h2>3. Visualizing</h2>
</form>
</div>
{% endblock %}

3 changes: 1 addition & 2 deletions application/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import bokeh.models
import bokeh.layouts
import lda
import pandas as pd
import threading
import lxml
import queue
Expand Down Expand Up @@ -65,8 +66,6 @@ def remove_markup(content):
text = '\n'.join(text)
text = re.sub(' ', '', text)
text = re.sub(' ', '', text)
text = re.sub('\n{1,6}', '', text)
text = re.sub('\n{1,6}', '\n', text)
text = re.sub('\n{1,6}', '\n', text)
text = re.sub('\n \n', '\n', text)
text = re.sub('\t\n', '', text)
Expand Down
5 changes: 2 additions & 3 deletions application/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def stream_template(template_name, **context):
app.update_template_context(context)
t = app.jinja_env.get_template(template_name)
return t.stream(context)

stream = flask.stream_with_context(application.modeling.create_model(TEMPDIR))
stream = flask.stream_with_context(application.modeling.create_model(TEMPDIR, bokeh_resources))
return flask.Response(stream_template('modeling.html', info=stream))


Expand All @@ -62,7 +61,7 @@ def model():
"""
Loads the dumped data, deletes the tempdir, and renders the model page.
"""
data = utils.load_data(TEMPDIR)
data = application.utils.load_data(TEMPDIR)
shutil.rmtree(TEMPDIR)
return flask.render_template('model.html', **data)

Expand Down
2 changes: 1 addition & 1 deletion topicsexplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument('--browser', action='store_true',
help="Opens the UI in the standard browser.")
help="Opens the UI in your standard browser.")

args = vars(parser.parse_args())

Expand Down

0 comments on commit aab2c7b

Please sign in to comment.