Commit 0798dbd 1 parent 99bd3b8 commit 0798dbd Copy full SHA for 0798dbd
File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import json
4
4
from ast import literal_eval
5
+ from typing import cast
5
6
6
7
import pandas as pd
7
8
from apiflask import APIBlueprint
@@ -149,10 +150,10 @@ def import_csv():
149
150
150
151
for _ , row in df .iterrows ():
151
152
document = Document (
152
- "" if pd .isna (row ["question" ]) else row ["question" ], # type: ignore
153
- row ["content" ], # type: ignore
154
- row ["source" ], # type: ignore
155
- "" if pd .isna (row ["label" ]) else row ["label" ], # type: ignore
153
+ question = cast ( str , "" if pd .isna (row ["question" ]) else row ["question" ]) , # type: ignore
154
+ content = cast ( str , row ["content" ]),
155
+ source = cast ( str , row ["source" ]),
156
+ label = cast ( str , "" if pd .isna (row ["label" ]) else row ["label" ]) , # type: ignore
156
157
)
157
158
db .session .add (document )
158
159
db .session .commit ()
You can’t perform that action at this time.
0 commit comments