Spaces:
Paused
Paused
Update service.py
Browse files- service.py +11 -7
service.py
CHANGED
@@ -10,13 +10,12 @@ command_output = []
|
|
10 |
def run_command():
|
11 |
global command_output
|
12 |
commands = [
|
13 |
-
# ['git clone --depth 1 https://huggingface.co/datasets/sciencialab/grobid-evaluation evaluation'],
|
14 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/PMC_sample_1943', '-Prun=1', '-PfileRatio=1'],
|
15 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/PLOS_1000', '-Prun=1', '-PfileRatio=1'],
|
16 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/biorxiv-10k-test-2000', '-Prun=1', '-PfileRatio=1'],
|
17 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/eLife_984', '-Prun=1', '-PfileRatio=1']
|
18 |
]
|
19 |
-
|
20 |
for command in commands:
|
21 |
process = subprocess.Popen(
|
22 |
command,
|
@@ -24,10 +23,15 @@ def run_command():
|
|
24 |
stderr=subprocess.PIPE,
|
25 |
text=True
|
26 |
)
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
31 |
process.stdout.close()
|
32 |
process.stderr.close()
|
33 |
process.wait()
|
@@ -49,4 +53,4 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
|
49 |
|
50 |
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
51 |
print(f"Serving on port {PORT}")
|
52 |
-
httpd.serve_forever()
|
|
|
10 |
def run_command():
|
11 |
global command_output
|
12 |
commands = [
|
|
|
13 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/PMC_sample_1943', '-Prun=1', '-PfileRatio=1'],
|
14 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/PLOS_1000', '-Prun=1', '-PfileRatio=1'],
|
15 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/biorxiv-10k-test-2000', '-Prun=1', '-PfileRatio=1'],
|
16 |
['./gradlew', 'jatsEval', '-Pp2t=/opt/grobid/evaluation/eLife_984', '-Prun=1', '-PfileRatio=1']
|
17 |
]
|
18 |
+
|
19 |
for command in commands:
|
20 |
process = subprocess.Popen(
|
21 |
command,
|
|
|
23 |
stderr=subprocess.PIPE,
|
24 |
text=True
|
25 |
)
|
26 |
+
while True:
|
27 |
+
output = process.stdout.readline()
|
28 |
+
if output == '' and process.poll() is not None:
|
29 |
+
break
|
30 |
+
if output:
|
31 |
+
command_output.append(output)
|
32 |
+
stderr_output = process.stderr.read()
|
33 |
+
if stderr_output:
|
34 |
+
command_output.append(stderr_output)
|
35 |
process.stdout.close()
|
36 |
process.stderr.close()
|
37 |
process.wait()
|
|
|
53 |
|
54 |
with socketserver.TCPServer(("", PORT), Handler) as httpd:
|
55 |
print(f"Serving on port {PORT}")
|
56 |
+
httpd.serve_forever()
|