Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,20 +10,22 @@ from dotenv import load_dotenv
|
|
10 |
# Load environment variables
|
11 |
load_dotenv()
|
12 |
|
13 |
-
# Create the Agent with a
|
14 |
agent = Agent(
|
15 |
model=Groq(id="llama-3.1-8b-instant", api_key=os.getenv("GROQ_API_KEY")),
|
16 |
tools=[DuckDuckGo(), Newspaper4k()],
|
17 |
-
description="
|
18 |
instructions=[
|
19 |
-
"Write
|
20 |
-
"
|
21 |
-
"
|
22 |
-
"
|
23 |
-
"
|
24 |
-
"
|
25 |
-
"
|
26 |
-
"
|
|
|
|
|
27 |
],
|
28 |
markdown=True,
|
29 |
show_tool_calls=True,
|
@@ -32,9 +34,9 @@ agent = Agent(
|
|
32 |
|
33 |
# Streamlit app
|
34 |
def main():
|
35 |
-
st.title("📝
|
36 |
st.markdown("""
|
37 |
-
|
38 |
""")
|
39 |
|
40 |
topic = st.text_input(
|
@@ -44,19 +46,19 @@ def main():
|
|
44 |
|
45 |
if st.button("Generate Article"):
|
46 |
if topic:
|
47 |
-
with st.spinner("Writing your article... (
|
48 |
|
49 |
-
#
|
50 |
prompt_variations = [
|
51 |
-
f"Write
|
52 |
-
f"Create a
|
53 |
-
f"Write
|
54 |
]
|
55 |
prompt = random.choice(prompt_variations)
|
56 |
|
57 |
response = agent.run(prompt)
|
58 |
|
59 |
-
st.markdown("## 📝 Your
|
60 |
st.markdown(response.content)
|
61 |
|
62 |
# Provide a regeneration option
|
|
|
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.1-8b-instant", 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 personality—some 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 |
|
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(
|
|
|
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 |
|
59 |
response = agent.run(prompt)
|
60 |
|
61 |
+
st.markdown("## 📝 Your Naturally Written Article")
|
62 |
st.markdown(response.content)
|
63 |
|
64 |
# Provide a regeneration option
|