import os import datetime # Define paths relative to IYmtg_Automation/ TRAINING_ROOT = "../IYmtg_Training" OUTPUT_FILE = "../IYmtg_App_iOS/app_description_update.txt" if not os.path.exists(TRAINING_ROOT) and os.path.exists("IYmtg_Training"): TRAINING_ROOT = "IYmtg_Training" OUTPUT_FILE = "IYmtg_App_iOS/app_description_update.txt" def count_images_in_dir(directory): count = 0 if os.path.exists(directory): for root, _, files in os.walk(directory): count += len([f for f in files if f.lower().endswith(('.jpg', '.jpeg', '.png'))]) return count def get_training_status(count, basic_threshold, advanced_threshold): if count == 0: return "❌ Inactive (0 images)" elif count < basic_threshold: # Less than 10 per category is generally unstable return f"⚠️ Experimental ({count} images - Needs {basic_threshold}+)" elif count < advanced_threshold: return f"✅ Basic ({count} images - Functional)" else: return f"🌟 Advanced ({count} images - High Accuracy)" def main(): print("Generating App Description Update...") # 1. Analyze Models foil_count = count_images_in_dir(os.path.join(TRAINING_ROOT, "Foil_Data")) stamp_count = count_images_in_dir(os.path.join(TRAINING_ROOT, "Stamp_Data")) cond_count = count_images_in_dir(os.path.join(TRAINING_ROOT, "Condition_Data")) # Set Symbols might be in Automation folder or Training folder set_sym_count = count_images_in_dir(os.path.join(TRAINING_ROOT, "Set_Symbol_Training")) if set_sym_count == 0: set_sym_count = count_images_in_dir("Set_Symbol_Training") # 2. Build Report lines = [] lines.append(f"IYmtg System Status - {datetime.date.today().strftime('%B %d, %Y')}") lines.append("==================================================") lines.append("") lines.append("🧠 AI MODEL STATUS") # Foil: 13 Classes. Min 130 (10/class), Adv 650 (50/class) lines.append(f"• Foil Classification: {get_training_status(foil_count, 130, 650)}") # Stamp: 2 Classes. Min 20 (10/class), Adv 100 (50/class) lines.append(f"• Promo Stamp Detection: {get_training_status(stamp_count, 20, 100)}") # Condition: 13 Classes. Min 130, Adv 650 lines.append(f"• Condition Grading: {get_training_status(cond_count, 130, 650)}") # Sets: Hundreds. Min 500, Adv 2000 lines.append(f"• Set Symbol Recog: {get_training_status(set_sym_count, 500, 2000)}") lines.append("") lines.append("👁️ IDENTIFICATION CAPABILITIES") lines.append("• Standard Cards: ✅ Active (Vector Fingerprinting)") lines.append("• Alpha vs Beta: ✅ Active (Corner Radius Detection)") lines.append("• Unlimited vs Revised: ✅ Active (Saturation Analysis)") lines.append("• The List / Mystery: ✅ Active (Symbol Detection)") lines.append("• World Champ Decks: ✅ Active (Gold Border Detection)") lines.append("• Chronicles Reprints: ✅ Active (Border Color Logic)") lines.append("• Serialized Cards: ✅ Active (OCR Number Pattern)") lines.append("• Summer Magic (Edgar): ✅ Active (OCR Copyright Date)") lines.append("") lines.append("📝 NOTE TO REVIEWER") lines.append("This build includes updated ML models based on the dataset sizes listed above.") lines.append("Features marked 'Inactive' will fallback to manual entry or basic heuristics.") # 3. Write to File try: with open(OUTPUT_FILE, "w", encoding="utf-8") as f: f.write("\n".join(lines)) print(f"Success! Description saved to: {os.path.abspath(OUTPUT_FILE)}") except Exception as e: print(f"Error writing report: {e}") if __name__ == "__main__": main()