Spaces:
Running
Running
Update app.py
Browse files
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
|
| 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,
|
| 18 |
instructions=[
|
| 19 |
-
"Write
|
| 20 |
-
"Use everyday language
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 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("📝
|
| 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
|
| 50 |
|
| 51 |
-
#
|
| 52 |
prompt_variations = [
|
| 53 |
-
f"Write an article about {topic}
|
| 54 |
-
f"
|
| 55 |
-
f"Write a
|
| 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 |
-
#
|
| 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 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,
|
|
|
|
| 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 |
|