Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetaRL
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Wang, Mia
MetaRL
Commits
35979486
Commit
35979486
authored
2 years ago
by
Mia Wang
Browse files
Options
Downloads
Patches
Plain Diff
react
parent
f117547f
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
react_app.py
+5
-6
5 additions, 6 deletions
react_app.py
react_backend/policy.txt
+1
-0
1 addition, 0 deletions
react_backend/policy.txt
test/web_app/test_flask_routes.py
+1
-1
1 addition, 1 deletion
test/web_app/test_flask_routes.py
with
8 additions
and
8 deletions
.gitignore
+
1
−
1
View file @
35979486
...
@@ -207,4 +207,4 @@ celerybeat.pid
...
@@ -207,4 +207,4 @@ celerybeat.pid
# user uplaod
# user uplaod
/react_backend/child_networks
/react_backend/child_networks
/react_backend/policy.txt
# /react_backend/policy.txt
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
react_app.py
+
5
−
6
View file @
35979486
...
@@ -17,12 +17,12 @@ torch.manual_seed(0)
...
@@ -17,12 +17,12 @@ torch.manual_seed(0)
print
(
'
@@@ import successful
'
)
print
(
'
@@@ import successful
'
)
app
=
Flask
(
__name__
,
static_folder
=
'
react_frontend/build
'
,
static_url_path
=
''
)
app
=
Flask
(
__name__
,
static_folder
=
'
react_frontend/build
'
,
static_url_path
=
'
/
'
)
CORS
(
app
)
CORS
(
app
)
# it is used to collect user input and store them in the app
# it is used to collect user input and store them in the app
@app.route
(
'
/home
'
,
methods
=
[
"
GET
"
,
"
POST
"
])
@app.route
(
'
/home
'
,
methods
=
[
"
GET
"
,
"
POST
"
])
# @cross_origin
# @cross_origin
()
def
get_form_data
():
def
get_form_data
():
print
(
'
@@@ in Flask Home
'
)
print
(
'
@@@ in Flask Home
'
)
# form_data = request.get_json()
# form_data = request.get_json()
...
@@ -122,7 +122,7 @@ def get_form_data():
...
@@ -122,7 +122,7 @@ def get_form_data():
# ========================================================================
# ========================================================================
@app.route
(
'
/confirm
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
@app.route
(
'
/confirm
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
#
@cross_origin
@cross_origin
()
def
confirm
():
def
confirm
():
print
(
'
inside confirm page
'
)
print
(
'
inside confirm page
'
)
data
=
current_app
.
config
[
'
data
'
]
data
=
current_app
.
config
[
'
data
'
]
...
@@ -133,7 +133,7 @@ def confirm():
...
@@ -133,7 +133,7 @@ def confirm():
# ========================================================================
# ========================================================================
@app.route
(
'
/training
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
@app.route
(
'
/training
'
,
methods
=
[
'
POST
'
,
'
GET
'
])
#
@cross_origin
@cross_origin
()
def
training
():
def
training
():
# default values
# default values
...
@@ -158,7 +158,7 @@ def training():
...
@@ -158,7 +158,7 @@ def training():
# ========================================================================
# ========================================================================
@app.route
(
'
/result
'
)
@app.route
(
'
/result
'
)
#
@cross_origin
@cross_origin
()
def
show_result
():
def
show_result
():
file_path
=
"
./react_backend/policy.txt
"
file_path
=
"
./react_backend/policy.txt
"
f
=
open
(
file_path
,
"
r
"
)
f
=
open
(
file_path
,
"
r
"
)
...
@@ -167,7 +167,6 @@ def show_result():
...
@@ -167,7 +167,6 @@ def show_result():
@app.route
(
'
/
'
)
@app.route
(
'
/
'
)
# @cross_origin
def
serve
():
def
serve
():
return
send_from_directory
(
app
.
static_folder
,
'
index.html
'
)
return
send_from_directory
(
app
.
static_folder
,
'
index.html
'
)
...
...
This diff is collapsed.
Click to expand it.
react_backend/policy.txt
0 → 100644
+
1
−
0
View file @
35979486
0.7018545454545454,0.6530636363636364,0.6565090909090909,0.7029727272727273,0.6615000000000001,0.6610181818181818,0.6333545454545454,0.6617909090909091,0.6584636363636364,0.6933909090909091
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/web_app/test_flask_routes.py
+
1
−
1
View file @
35979486
...
@@ -15,7 +15,7 @@ class MyTestCase(unittest.TestCase):
...
@@ -15,7 +15,7 @@ class MyTestCase(unittest.TestCase):
self
.
app
=
react_app
.
app
.
test_client
()
self
.
app
=
react_app
.
app
.
test_client
()
def
test_home
(
self
):
def
test_home
(
self
):
response
=
self
.
app
.
get
(
'
/
home
'
)
response
=
self
.
app
.
get
(
'
/
'
)
def
test_training
(
self
):
def
test_training
(
self
):
response
=
self
.
app
.
get
(
'
/training
'
)
response
=
self
.
app
.
get
(
'
/training
'
)
...
...
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