Spaces:
Configuration error
Configuration error
Download compare.py from bacancydataprophets/Metal_Defect_Detection: direct link, hf CLI and curl.
- Browser
- Download file 924 Bytes
-
https://huggingface.co/spaces/bacancydataprophets/Metal_Defect_Detection/resolve/main/compare.py
- Command line
-
hf download hf://spaces/bacancydataprophets/Metal_Defect_Detection/compare.py
-
curl -L -o compare.py https://huggingface.co/spaces/bacancydataprophets/Metal_Defect_Detection/resolve/main/compare.py
924 Bytes
| import pandas as pd | |
| class Compare: | |
| def comparison(self, df, df1): | |
| final = df.merge(df1, on='Image/File Name') | |
| final.drop_duplicates(subset=['Confidence Score'], keep='first', inplace=True) | |
| final = final.reset_index().drop(columns=['index']) | |
| fnl_cls = [] | |
| fnl_cnf = [] | |
| for i in range(0, len(final['Confidence Score'])): | |
| if final['Confidence Score'][i] > final['Conf score'][i]: | |
| fnl_cls.append(final['Detected Class'][i]) | |
| fnl_cnf.append(final['Confidence Score'][i]) | |
| else: | |
| fnl_cls.append(final['Detected class by cls'][i]) | |
| fnl_cnf.append(final['Conf score'][i]) | |
| final['fnl_cls'] = fnl_cls | |
| final['fnl_pred'] = fnl_cnf | |
| final = final.drop(columns=['Detected Class', 'Confidence Score', 'Detected class by cls', 'Conf score']) | |
| return final | |