File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -306,11 +306,12 @@ def text_explanation_prediction_wrapper(
306306) -> Callable :
307307 def text_predict (text_documents : List [str ]):
308308 num_documents = len (text_documents )
309- if num_documents <= 1 :
310- df_with_text_documents = pd .DataFrame (input_example )
311- else :
312- df_with_text_documents = pd .concat ([input_example ] * (num_documents ), ignore_index = True )
313- df_with_text_documents [text_column ] = pd .DataFrame (text_documents )
309+ df_with_text_documents = (
310+ input_example .copy (deep = True )
311+ if num_documents == 1
312+ else pd .concat ([input_example ] * num_documents , ignore_index = True )
313+ )
314+ df_with_text_documents [text_column ] = text_documents
314315 return prediction_function (df_with_text_documents )
315316
316317 return text_predict
You can’t perform that action at this time.
0 commit comments