Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,20 +10,21 @@ from dotenv import load_dotenv
|
|
| 10 |
# Load environment variables
|
| 11 |
load_dotenv()
|
| 12 |
|
| 13 |
-
#
|
| 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="
|
| 18 |
instructions=[
|
| 19 |
-
"
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
|
|
|
| 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("
|
| 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 |
-
#
|
| 48 |
prompt_variations = [
|
| 49 |
-
f"Write an article
|
| 50 |
-
f"
|
| 51 |
-
f"Write a
|
| 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 |
-
#
|
| 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 |
|