Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
|
3 |
+
# Use a pipeline as a high-level helper
|
4 |
+
pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True)
|
5 |
+
|
6 |
+
# Function to generate a reply based on user's input email content
|
7 |
+
def generate_reply(email_content):
|
8 |
+
messages = [
|
9 |
+
{"role": "user", "content": f"Generate a professional email reply to the following email: {email_content}"}
|
10 |
+
]
|
11 |
+
# Get the reply from the model
|
12 |
+
reply = pipe(messages)
|
13 |
+
return reply[0]['generated_text']
|
14 |
+
|
15 |
+
# Example usage
|
16 |
+
user_email = "Dear team, I hope this email finds you well. Could you provide an update on the project status?"
|
17 |
+
generated_reply = generate_reply(user_email)
|
18 |
+
print(f"Generated Reply: {generated_reply}")
|