Move demo files into subdirectory
Browse files- README.md +1 -2
- app.py → demo/app.py +6 -3
- config.yaml → demo/config.yaml +0 -0
- model.onnx → demo/model.onnx +0 -0
- setup.cfg +14 -0
README.md
CHANGED
@@ -5,7 +5,7 @@ colorFrom: gray
|
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.27.0
|
8 |
-
app_file: app.py
|
9 |
pinned: false
|
10 |
language: en
|
11 |
tags:
|
@@ -13,5 +13,4 @@ tags:
|
|
13 |
- MARC
|
14 |
- pytorch
|
15 |
library_name: pytorch
|
16 |
-
|
17 |
---
|
|
|
5 |
colorTo: gray
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.27.0
|
8 |
+
app_file: demo/app.py
|
9 |
pinned: false
|
10 |
language: en
|
11 |
tags:
|
|
|
13 |
- MARC
|
14 |
- pytorch
|
15 |
library_name: pytorch
|
|
|
16 |
---
|
app.py → demo/app.py
RENAMED
@@ -5,6 +5,9 @@ from marcai.utils.parsing import record_dict
|
|
5 |
import pandas as pd
|
6 |
from marcai.predict import predict_onnx
|
7 |
from marcai.utils import load_config
|
|
|
|
|
|
|
8 |
|
9 |
def compare(file1, file2):
|
10 |
record1 = pymarc.parse_xml_to_array(file1)[0]
|
@@ -16,8 +19,8 @@ def compare(file1, file2):
|
|
16 |
df = process(df1, df2)
|
17 |
|
18 |
# Load model config
|
19 |
-
config = load_config("config.yaml")
|
20 |
-
model_onnx = "model.onnx"
|
21 |
|
22 |
# Run ONNX model
|
23 |
input_df = df[config["model"]["features"]]
|
@@ -39,4 +42,4 @@ interface = gr.Interface(
|
|
39 |
description="Upload two MARC XML files with one record each.",
|
40 |
allow_flagging="never"
|
41 |
)
|
42 |
-
interface.launch()
|
|
|
5 |
import pandas as pd
|
6 |
from marcai.predict import predict_onnx
|
7 |
from marcai.utils import load_config
|
8 |
+
import os
|
9 |
+
|
10 |
+
demo_dir = os.path.dirname(os.path.realpath(__file__))
|
11 |
|
12 |
def compare(file1, file2):
|
13 |
record1 = pymarc.parse_xml_to_array(file1)[0]
|
|
|
19 |
df = process(df1, df2)
|
20 |
|
21 |
# Load model config
|
22 |
+
config = load_config(os.path.join(demo_dir, "config.yaml"))
|
23 |
+
model_onnx = os.path.join(demo_dir, "model.onnx")
|
24 |
|
25 |
# Run ONNX model
|
26 |
input_df = df[config["model"]["features"]]
|
|
|
42 |
description="Upload two MARC XML files with one record each.",
|
43 |
allow_flagging="never"
|
44 |
)
|
45 |
+
interface.launch()
|
config.yaml → demo/config.yaml
RENAMED
File without changes
|
model.onnx → demo/model.onnx
RENAMED
File without changes
|
setup.cfg
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[metadata]
|
2 |
+
name = marcai
|
3 |
+
version = 1.0.0
|
4 |
+
|
5 |
+
[options]
|
6 |
+
packages = find:
|
7 |
+
|
8 |
+
[options.entry_points]
|
9 |
+
console_scripts =
|
10 |
+
process = marcai:process.main
|
11 |
+
predict = marcai:predict.main
|
12 |
+
train = marcai:train.main
|
13 |
+
compare_records = marcai:compare_records.main
|
14 |
+
|