Manasa1 commited on
Commit
f1e2308
·
verified ·
1 Parent(s): ec1aebf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -10,20 +10,21 @@ from dotenv import load_dotenv
10
  # Load environment variables
11
  load_dotenv()
12
 
13
- # Create the Agent with a conversational, natural writing style
14
  agent = Agent(
15
  model=Groq(id="llama-3.3-70b-specdec", api_key=os.getenv("GROQ_API_KEY")),
16
  tools=[DuckDuckGo(), Newspaper4k()],
17
- description="You write like a real person—casual, engaging, and natural.",
18
  instructions=[
19
- "Write in a way that feels human. Keep it natural, conversational, and engaging.",
20
- "Use simple words, everyday language, and a mix of short and long sentences.",
21
- "Write as if explaining to a friend—friendly, relaxed, and fun.",
22
- "Avoid jargon, robotic structures, and overly complex words.",
23
- "Throw in humor, relatable examples, or even mild sarcasm where it fits.",
24
- "Don't overthink grammar—sentence fragments and informal phrasing are okay.",
25
- "React naturally to surprising or interesting facts.",
26
- "Most importantly: Make the article sound genuinely human, not AI-generated."
 
27
  ],
28
  markdown=True,
29
  show_tool_calls=True,
@@ -33,7 +34,7 @@ agent = Agent(
33
  # Streamlit app
34
  def main():
35
  st.title("📝 Human-Like Article Generator")
36
- st.markdown("Generate articles that feel natural, like a person actually wrote them.")
37
 
38
  topic = st.text_input(
39
  "Enter your article topic:",
@@ -42,13 +43,13 @@ def main():
42
 
43
  if st.button("Generate Article"):
44
  if topic:
45
- with st.spinner("Writing your article... (Making it sound real)"):
46
 
47
- # Vary the prompt slightly to add randomness
48
  prompt_variations = [
49
- f"Write an article about {topic} in a relaxed, human-like tone. Keep it simple and engaging.",
50
- f"Explain {topic} as if you're talking to a friend. Make it casual and fun.",
51
- f"Write a natural, engaging article on {topic}. No robotic phrasing—just real, human writing."
52
  ]
53
  prompt = random.choice(prompt_variations)
54
 
@@ -57,7 +58,7 @@ def main():
57
  st.markdown("## 📝 Your Naturally Written Article")
58
  st.markdown(response.content)
59
 
60
- # Regeneration option
61
  if st.button("Regenerate Article"):
62
  st.experimental_rerun()
63
 
 
10
  # Load environment variables
11
  load_dotenv()
12
 
13
+ # Set up the AI agent to generate more natural, human-like writing
14
  agent = Agent(
15
  model=Groq(id="llama-3.3-70b-specdec", api_key=os.getenv("GROQ_API_KEY")),
16
  tools=[DuckDuckGo(), Newspaper4k()],
17
+ description="Write in a way that sounds like a real person. No robotic structures, just natural and engaging storytelling.",
18
  instructions=[
19
+ "Keep it simple and conversational, like you're talking to a friend.",
20
+ "No fancy words or robotic phrasing—just natural language.",
21
+ "Vary sentence lengths, throw in a casual phrase, and keep it real.",
22
+ "If something surprises you, react to it. If it's boring, say so.",
23
+ "Don't force perfect grammar—if a sentence feels better as a fragment, go with it.",
24
+ "Make it fun. A little humor, a tiny rant, or a personal touch goes a long way.",
25
+ "Talk to the reader. Use 'you' and 'we' to make it feel more personal.",
26
+ "If a fact sounds weird, acknowledge it. If a statement is bold, justify it.",
27
+ "Bottom line: Make it sound like something a real person actually wrote.",
28
  ],
29
  markdown=True,
30
  show_tool_calls=True,
 
34
  # Streamlit app
35
  def main():
36
  st.title("📝 Human-Like Article Generator")
37
+ st.markdown("Get articles that actually sound like a person wrote them—natural, engaging, and fun.")
38
 
39
  topic = st.text_input(
40
  "Enter your article topic:",
 
43
 
44
  if st.button("Generate Article"):
45
  if topic:
46
+ with st.spinner("Writing your article... (Making it sound as real as possible)"):
47
 
48
+ # Human-like prompt variations
49
  prompt_variations = [
50
+ f"Write an article on {topic} like you're explaining it to a friend over coffee.",
51
+ f"Tell a story about {topic}. Keep it casual, engaging, and easy to read.",
52
+ f"Write a fun, natural article on {topic}—no robotic tone, just real talk.",
53
  ]
54
  prompt = random.choice(prompt_variations)
55
 
 
58
  st.markdown("## 📝 Your Naturally Written Article")
59
  st.markdown(response.content)
60
 
61
+ # Provide a regeneration option
62
  if st.button("Regenerate Article"):
63
  st.experimental_rerun()
64