File size: 727 Bytes
947fea7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from transformers import pipeline

# Use a pipeline as a high-level helper
pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)

# Function to generate a reply based on user's input email content
def generate_reply(email_content):
    messages = [
        {"role": "user", "content": f"Generate a professional email reply to the following email: {email_content}"}
    ]
    # Get the reply from the model
    reply = pipe(messages)
    return reply[0]['generated_text']

# Example usage
user_email = "Dear team, I hope this email finds you well. Could you provide an update on the project status?"
generated_reply = generate_reply(user_email)
print(f"Generated Reply: {generated_reply}")