Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SimpleHTR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fabian Mersch
SimpleHTR
Commits
df06b7f5
Commit
df06b7f5
authored
1 year ago
by
merschie
Browse files
Options
Downloads
Patches
Plain Diff
send all Matr. numbers
parent
85721ca0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/webserver.py
+15
-2
15 additions, 2 deletions
src/webserver.py
with
15 additions
and
2 deletions
src/webserver.py
+
15
−
2
View file @
df06b7f5
...
@@ -18,6 +18,14 @@ csv_path = '../Studenten.csv'
...
@@ -18,6 +18,14 @@ csv_path = '../Studenten.csv'
char_list
=
htr
.
char_list_from_file
()
char_list
=
htr
.
char_list_from_file
()
chars
=
''
.
join
(
char_list
)
chars
=
''
.
join
(
char_list
)
word_chars
=
open
(
'
../model/wordCharList.txt
'
).
read
().
splitlines
()[
0
]
word_chars
=
open
(
'
../model/wordCharList.txt
'
).
read
().
splitlines
()[
0
]
matrikel_numbers
=
[]
@app.route
(
'
/getNames
'
,
methods
=
[
'
GET
'
])
def
getNames
():
return
jsonify
(
matrikel_numbers
)
@app.route
(
'
/predictNachname
'
,
methods
=
[
'
POST
'
])
@app.route
(
'
/predictNachname
'
,
methods
=
[
'
POST
'
])
def
predictNach
():
def
predictNach
():
...
@@ -67,6 +75,7 @@ def predictVor():
...
@@ -67,6 +75,7 @@ def predictVor():
}
}
return
jsonify
(
result
)
return
jsonify
(
result
)
def
split_Student_Names
():
def
split_Student_Names
():
#csv looks like: Vorname;Nachname;Matrikelnummer
#csv looks like: Vorname;Nachname;Matrikelnummer
#need to put Vorname in one list, Nachname in another
#need to put Vorname in one list, Nachname in another
...
@@ -74,7 +83,8 @@ def split_Student_Names():
...
@@ -74,7 +83,8 @@ def split_Student_Names():
#create /data/Vorname.txt and /data/Nachname.txt
#create /data/Vorname.txt and /data/Nachname.txt
vorname_file
=
open
(
'
../data/Vorname.txt
'
,
'
w
'
)
vorname_file
=
open
(
'
../data/Vorname.txt
'
,
'
w
'
)
nachname_file
=
open
(
'
../data/Nachname.txt
'
,
'
w
'
)
nachname_file
=
open
(
'
../data/Nachname.txt
'
,
'
w
'
)
matrikelnummer_file
=
open
(
'
../data/Matrikelnummer.txt
'
,
'
w
'
)
numbers
=
[]
with
open
(
csv_path
,
'
r
'
)
as
csv_file
:
with
open
(
csv_path
,
'
r
'
)
as
csv_file
:
lines
=
csv_file
.
readlines
()
lines
=
csv_file
.
readlines
()
for
line
in
lines
[
1
:]:
for
line
in
lines
[
1
:]:
...
@@ -85,11 +95,14 @@ def split_Student_Names():
...
@@ -85,11 +95,14 @@ def split_Student_Names():
print
(
vorname
,
nachname
,
matrikelnummer
)
print
(
vorname
,
nachname
,
matrikelnummer
)
vorname_file
.
write
(
vorname
+
"
"
)
vorname_file
.
write
(
vorname
+
"
"
)
nachname_file
.
write
(
nachname
+
"
"
)
nachname_file
.
write
(
nachname
+
"
"
)
matrikelnummer_file
.
write
(
matrikelnummer
+
"
"
)
numbers
.
append
(
matrikelnummer
)
return
numbers
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
#split csv file into Vorname, Nachname and Matrikelnummer
#split csv file into Vorname, Nachname and Matrikelnummer
split_Student_Names
()
matrikel_numbers
=
split_Student_Names
()
app
.
run
(
debug
=
True
,
port
=
8000
)
app
.
run
(
debug
=
True
,
port
=
8000
)
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