Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -189,13 +189,25 @@ if research_button and topic:
|
|
| 189 |
if not all_sources:
|
| 190 |
raise ValueError("Unable to fetch any sources. Please try again later.")
|
| 191 |
|
|
|
|
| 192 |
merged = merge_duplicates(all_sources)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
citations = [generate_apa_citation(m['title'], m['url'], m['source']) for m in merged]
|
| 194 |
combined_text = "\n\n".join(
|
| 195 |
[f"- [{m['title']}]({m['url']})\n> {m.get('snippet', m.get('summary', ''))[:300]}..." for m in merged]
|
| 196 |
)
|
| 197 |
status.update(label="🧠 Synthesizing final report...")
|
| 198 |
|
|
|
|
| 199 |
prompt = f"""
|
| 200 |
You are an expert assistant. Based on the following sources, write a {report_type.lower()} in a {tone.lower()} tone on the topic: {topic}.
|
| 201 |
|
|
|
|
| 189 |
if not all_sources:
|
| 190 |
raise ValueError("Unable to fetch any sources. Please try again later.")
|
| 191 |
|
| 192 |
+
|
| 193 |
merged = merge_duplicates(all_sources)
|
| 194 |
+
|
| 195 |
+
st.markdown("---")
|
| 196 |
+
st.subheader("🖼 Source Previews")
|
| 197 |
+
|
| 198 |
+
cols = st.columns(2)
|
| 199 |
+
for i, m in enumerate(merged):
|
| 200 |
+
if m.get("image_url"):
|
| 201 |
+
with cols[i % 2]:
|
| 202 |
+
st.image(m["image_url"], caption=m["title"], use_column_width=True)
|
| 203 |
+
|
| 204 |
citations = [generate_apa_citation(m['title'], m['url'], m['source']) for m in merged]
|
| 205 |
combined_text = "\n\n".join(
|
| 206 |
[f"- [{m['title']}]({m['url']})\n> {m.get('snippet', m.get('summary', ''))[:300]}..." for m in merged]
|
| 207 |
)
|
| 208 |
status.update(label="🧠 Synthesizing final report...")
|
| 209 |
|
| 210 |
+
|
| 211 |
prompt = f"""
|
| 212 |
You are an expert assistant. Based on the following sources, write a {report_type.lower()} in a {tone.lower()} tone on the topic: {topic}.
|
| 213 |
|