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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -22
app.py CHANGED
@@ -10,22 +10,20 @@ from dotenv import load_dotenv
10
  # Load environment variables
11
  load_dotenv()
12
 
13
- # Create the Agent with a more natural, imperfect human-like 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, not a robot. Your writing is simple, engaging, and casual—like a conversation with a friend.",
18
  instructions=[
19
- "Write like a real human, not AI. Keep it simple, clear, and natural.",
20
- "Use everyday language. No fancy words. No robotic structures.",
21
- "Make sentences short and varied—some are quick, others take their time.",
22
- "Talk to the reader. Imagine you're chatting with a friend.",
23
- "Use words like 'honestly,' 'to be fair,' 'you know what I mean?' for a natural feel.",
24
- "Add a bit of personalitysome humor, a quick side note, maybe even a mild complaint.",
25
- "Don't try too hard to sound smart. Just be real and interesting.",
26
- "Forget perfect grammar. If a sentence feels better as a fragment, use it.",
27
- "If something is surprising, react to it. If something is boring, admit it.",
28
- "Most importantly: Make it sound like something a human actually wrote."
29
  ],
30
  markdown=True,
31
  show_tool_calls=True,
@@ -34,10 +32,8 @@ agent = Agent(
34
 
35
  # Streamlit app
36
  def main():
37
- st.title("📝 Real Human-Like Article Generator")
38
- st.markdown("""
39
- Get articles that actually sound like a person wrote them—simple, natural, and engaging.
40
- """)
41
 
42
  topic = st.text_input(
43
  "Enter your article topic:",
@@ -46,13 +42,13 @@ def main():
46
 
47
  if st.button("Generate Article"):
48
  if topic:
49
- with st.spinner("Writing your article... (Making it sound as real as possible)"):
50
 
51
- # Human-like prompt variations
52
  prompt_variations = [
53
- f"Write an article about {topic} that sounds like a real person wrote it. Keep it casual, simple, and engaging.",
54
- f"Create a natural, fun article on {topic}. Write like you're telling a friend about it.",
55
- f"Write a casual, human-like article on {topic}. No complex words, no robotic structure—just natural writing.",
56
  ]
57
  prompt = random.choice(prompt_variations)
58
 
@@ -61,7 +57,7 @@ def main():
61
  st.markdown("## 📝 Your Naturally Written Article")
62
  st.markdown(response.content)
63
 
64
- # Provide a regeneration option
65
  if st.button("Regenerate Article"):
66
  st.experimental_rerun()
67
 
 
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 grammarsentence 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,
 
32
 
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
 
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
  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