#!/usr/bin/env python3 """Test single email analysis""" import requests import json email_data = { "subject": "Fwd: Get 10% off your next order 🎉", "sender": "crac1017@hotmail.com", "body": "Get 10% off your next order! Limited time offer. Shop now and save!" } prompt = f"""Analyze this email and determine if it's an advertisement/promotional email. Subject: {email_data['subject']} Sender: {email_data['sender']} Body preview: {email_data['body'][:200]} Is this an advertisement or promotional email? Answer with ONLY: - "AD: [brief reason]" if it's an ad/promo - "KEEP: [brief reason]" if it's important/legitimate Be conservative - only mark as AD if clearly promotional.""" print("Sending to Qwen3...") try: response = requests.post( "http://localhost:11434/api/generate", json={ "model": "qwen3:4b", "prompt": prompt, "stream": False }, timeout=120 ) result = response.json() print(f"Result: {result.get('response', 'error')}") except Exception as e: print(f"Error: {e}")