I have made a Cricket score predictor in python using sklearn and streamlit. However when i run the app using the python -m streamlit run app.py
command in my VScode terminal the app does open up and lets me interact with the selectboxes I have placed on the screen to let me select different teams, venues, enter the score, wickets. But the main issue is that as soon as I click the “Predict” button to predict the final score of the match, it gives me the “AttributeError: ‘str’ object has no attribute 'transform”
Streamlit version -1.37.1
Python Version - 3.11.5
AttributeError: 'str' object has no attribute 'transform'
Traceback:
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\streamlit\runtime\scriptrunner\exec_code.py", line 85, in exec_func_with_error_handling
result = func()
^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 576, in code_to_exec
exec(code, module.__dict__)
File "F:\Mayuresh\Projects\Cricket Score Prediction\Dataset\app.py", line 104, in <module>
result = pipe.predict(input_df)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\sklearn\pipeline.py", line 600, in predict
Xt = transform.transform(Xt)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\sklearn\utils\_set_output.py", line 313, in wrapped
data_to_wrap = f(self, X, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\sklearn\compose\_column_transformer.py", line 1076, in transform
Xs = self._call_func_on_transformers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\sklearn\compose\_column_transformer.py", line 885, in _call_func_on_transformers
return Parallel(n_jobs=self.n_jobs)(jobs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\sklearn\utils\parallel.py", line 74, in __call__
return super().__call__(iterable_with_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\joblib\parallel.py", line 1918, in __call__
return output if self.return_generator else list(output)
^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\joblib\parallel.py", line 1847, in _get_sequential_output
res = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\sklearn\utils\parallel.py", line 136, in __call__
return self.function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\HI\AppData\Roaming\Python\Python311\site-packages\sklearn\pipeline.py", line 1290, in _transform_one
res = transformer.transform(X, **params.transform)
^^^^^^^^^^^^^^^^^^^^^