Spaces:
Sleeping
Sleeping
fix response
Browse files
app.py
CHANGED
@@ -35,13 +35,12 @@ def summarize_articles(topic: str) -> str:
|
|
35 |
page = wikipedia.page(title)
|
36 |
content = page.content[:4000]
|
37 |
prompt = f"Summarize the following text:\n\n{content}\n\nSummary:"
|
38 |
-
|
39 |
-
summary = response.get("generated_text", "").strip()
|
40 |
url = str(URL(page.url))
|
41 |
summaries.append(f"URL: {url}\n\nSummary:\n{summary}\n{'-'*80}")
|
42 |
except (wikipedia.exceptions.DisambiguationError, wikipedia.exceptions.PageError):
|
43 |
continue
|
44 |
-
if summaries:
|
45 |
return "\n\n".join(summaries)
|
46 |
else:
|
47 |
return "No articles found or unable to generate summaries."
|
|
|
35 |
page = wikipedia.page(title)
|
36 |
content = page.content[:4000]
|
37 |
prompt = f"Summarize the following text:\n\n{content}\n\nSummary:"
|
38 |
+
summary = client.text_generation(prompt)
|
|
|
39 |
url = str(URL(page.url))
|
40 |
summaries.append(f"URL: {url}\n\nSummary:\n{summary}\n{'-'*80}")
|
41 |
except (wikipedia.exceptions.DisambiguationError, wikipedia.exceptions.PageError):
|
42 |
continue
|
43 |
+
if summaries is not None:
|
44 |
return "\n\n".join(summaries)
|
45 |
else:
|
46 |
return "No articles found or unable to generate summaries."
|