Commit b8861048 authored by SimonGlomb's avatar SimonGlomb
Browse files

determine pass arguments to main

parent 79ef151f
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
This diff is collapsed.
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (oc-dfg-clustering)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/oc-dfg-clustering.iml" filepath="$PROJECT_DIR$/.idea/oc-dfg-clustering.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="Flask">
<option name="enabled" value="true" />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/code/templates" />
</list>
</option>
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -4,23 +4,36 @@ import model
app = Flask(__name__)
params = []
@app.route("/")
def hello_world():
form = model.MyForm()
return render_template('start_page.html', form=form)
@app.route("/run_code", methods=["POST"])
@app.route("/run_code", methods=["GET"])
def run_code():
data = request.form
print(data)
#os.system("python ./code/main.py")
global params
varX = "python ./code/main.py " + str(params[0])
print(varX)
os.system("python ./code/main.py " + str(params[0]))
return "<p>Back to Main Page</p>"
@app.route("/set_params", methods=["POST"])
def set_params():
global params
ocel_file = request.form.get("ocel_file")
form = model.MyForm()
print(form.name.data)
params = [form.ocel_file.data,
form.mode.data,
form.attr_weights.data,
form.object_type.data,
form.clustering_mode.data,
form.cluster_count.data,
form.ocel_file_type.data,
form.graph_file_type.data]
print(params)
if form.validate_on_submit():
return "<p>Parameters where set successfully.</p>"
return render_template('start_page.html', form=form)
......@@ -33,4 +46,4 @@ def get_oc_dfg():
if __name__ == "__main__":
SECRET_KEY = os.urandom(32)
app.config['SECRET_KEY'] = SECRET_KEY
app.run()
\ No newline at end of file
app.run(debug=True)
\ No newline at end of file
......@@ -10,9 +10,43 @@ import functions as f
import cluster
from sklearn import cluster as skcluster
import argparse
CLI=argparse.ArgumentParser()
CLI.add_argument(
"p_ocel_file", # name on the CLI - drop the `--` for positional/required parameters
type=str,
default=[], # default if nothing is provided # TODO
)
# CLI.add_argument(
# "p_ocel_file", # name on the CLI - drop the `--` for positional/required parameters
# type=str,
# default=['./data/ocel.jsonocel'], # default if nothing is provided # TODO
# )
# CLI.add_argument(
# "p_ocel_file", # name on the CLI - drop the `--` for positional/required parameters
# type=str,
# default=['./data/ocel.jsonocel'], # default if nothing is provided # TODO
# )
# CLI.add_argument(
# "p_ocel_file", # name on the CLI - drop the `--` for positional/required parameters
# type=str,
# default=['./data/ocel.jsonocel'], # default if nothing is provided # TODO
# )
# CLI.add_argument(
# "p_ocel_file", # name on the CLI - drop the `--` for positional/required parameters
# type=str,
# default=['./data/ocel.jsonocel'], # default if nothing is provided # TODO
# )
# CLI.add_argument(
# "p_ocel_file", # name on the CLI - drop the `--` for positional/required parameters
# type=str,
# default=['./data/ocel.jsonocel'], # default if nothing is provided # TODO
# )
args = CLI.parse_args()
#
# PARAMETERS
p_ocel_file = './data/ocel.jsonocel'
p_ocel_file = args.p_ocel_file
p_mode = 'existence' # all | existence
p_object_type = 'products' # object-type-name, options depend on the data
p_attr_weights = {
......
<form action="{{ url_for('set_params') }}" method="post" name=params enctype="multipart/form-data">
<input type="text" name=ocel_file id="ocel_file" size="40" placeholder="Set ocel File">
<input type="text" name=mode id="mode" size="40" placeholder="Set mode">
<input type="text" name=object_type id="object_type" size="40" placeholder="Set object_type">
<input type="text" name=attr_weights id="attr_weights" size="40" placeholder="Set attr_weights">
<input type="text" name=clustering_mode id="clustering_mode" size="40" placeholder="Set clustering_mode">
<input type="text" name=cluster_count id="cluster_count" size="40" placeholder="Set cluster_count">
<input type="text" name=ocel_file_type id="ocel_file_type" size="40" placeholder="Set ocel_file_type">
<input type="text" name=graph_file_type id="graph_file_type" size="40" placeholder="Set graph_file_type">
<button name="set_params" value="Set">Set</button>
</form>
<form method="POST" action="{{ url_for('set_params') }}">
{{ form.csrf_token }}
{{ form.name.label }} {{ form.name(size=20) }}
<input type="submit" value="Set">
{{ form.ocel_file.label }} {{ form.ocel_file(size=20) }}
{{ form.mode.label }} {{ form.mode(size=20) }}
{{ form.object_type.label }} {{ form.object_type(size=20) }}
{{ form.attr_weights.label }} {{ form.attr_weights(size=20) }}
{{ form.clustering_mode.label }} {{ form.clustering_mode(size=20) }}
{{ form.cluster_count.label }} {{ form.cluster_count(size=20) }}
{{ form.ocel_file_type.label }} {{ form.ocel_file_type(size=20) }}
{{ form.graph_file_type.label }} {{ form.graph_file_type(size=20) }}
<input name="set_params" type="submit" value="Set">
</form>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment