aahmed10202 commited on
Commit
8e1d66e
·
verified ·
1 Parent(s): f5c8c9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -11
app.py CHANGED
@@ -1,18 +1,24 @@
 
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}")
 
1
+ import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Title of the Streamlit app
5
+ st.title("Email Reply Generator")
6
 
7
+ # Set up the pipeline for text generation using the replycraft model
8
+ pipe = pipeline("text-generation", model="replycraft/replycraft", trust_remote_code=True)
9
+
10
+ # Get email content from the user
11
+ email_content = st.text_area("Enter the email content")
12
+
13
+ if email_content:
14
+ # Prepare the messages and get the generated reply
15
  messages = [
16
  {"role": "user", "content": f"Generate a professional email reply to the following email: {email_content}"}
17
  ]
18
+
19
+ # Generate the reply using the model
20
+ generated_reply = pipe(messages)
21
+
22
+ # Display the generated reply
23
+ st.json(generated_reply)
24