DrishtiSharma commited on
Commit
f7a52fb
Β·
verified Β·
1 Parent(s): cffd438

Update post_generator.py

Browse files
Files changed (1) hide show
  1. post_generator.py +38 -2
post_generator.py CHANGED
@@ -13,10 +13,46 @@ def get_length_str(length):
13
  return "11 to 15 lines"
14
 
15
 
16
- def generate_post(length, language, tag):
17
  prompt = get_prompt(length, language, tag)
18
  response = llm.invoke(prompt)
19
- return response.content
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
 
22
  def get_prompt(length, language, tag):
 
13
  return "11 to 15 lines"
14
 
15
 
16
+ def generate_post(length, language, tag, selected_tone=None):
17
  prompt = get_prompt(length, language, tag)
18
  response = llm.invoke(prompt)
19
+ post_content = response.content
20
+
21
+ # Add closing statements dynamically based on tone
22
+ closing_lines = {
23
+ "Motivational": [
24
+ "Stay inspired and keep moving forward! πŸ’ͺ",
25
+ "Your journey to greatness begins today. 🌟",
26
+ "Remember, small steps lead to big achievements. πŸš€",
27
+ "Keep pushing your boundaries. You’ve got this! πŸ”₯"
28
+ ],
29
+ "Professional": [
30
+ "Looking forward to hearing your thoughts! πŸ‘”",
31
+ "Let’s collaborate and make an impact together. 🌐",
32
+ "Feel free to share your perspective below. πŸ“’",
33
+ "Insights and feedback are always welcome. πŸ’‘"
34
+ ],
35
+ "Informal": [
36
+ "What do you think? Let's chat in the comments! πŸ˜„",
37
+ "Drop your thoughts below, would love to hear from you! πŸ—¨οΈ",
38
+ "Let’s keep the conversation rolling. Share your views! πŸš€",
39
+ "Got something to add? Don’t hold back! 😎"
40
+ ],
41
+ "Neutral": [
42
+ "Thank you for reading. Your feedback is valued! πŸ™Œ",
43
+ "Let’s connect and share ideas. 🌟",
44
+ "Looking forward to engaging with you in the comments. πŸ’¬",
45
+ "Your thoughts are always appreciated. 😊"
46
+ ]
47
+ }
48
+
49
+ if selected_tone and selected_tone in closing_lines:
50
+ # Randomly select a closing line from the appropriate tone category
51
+ import random
52
+ post_content += f"\n\n{random.choice(closing_lines[selected_tone])}"
53
+
54
+ return post_content
55
+
56
 
57
 
58
  def get_prompt(length, language, tag):