Spaces:
Sleeping
Sleeping
Aswin Candra
commited on
Commit
·
1965ec1
1
Parent(s):
d99dc65
add source urls for summary
Browse files
app.py
CHANGED
@@ -74,6 +74,7 @@ def dropdown_trend(year_txt, month_txt, date_txt):
|
|
74 |
|
75 |
def generate(topic, trends_dic):
|
76 |
article_urls = fetch_article_urls(trends_dic, topic)
|
|
|
77 |
article_docs = [extract_article(url) for url in article_urls]
|
78 |
|
79 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
@@ -156,7 +157,7 @@ def generate(topic, trends_dic):
|
|
156 |
|
157 |
res = sequentialChain({"input_documents": article_docs})
|
158 |
|
159 |
-
summary = [res['translated_summary']]
|
160 |
generated_res = json.loads(res['output_text'])
|
161 |
|
162 |
tweets = []
|
|
|
74 |
|
75 |
def generate(topic, trends_dic):
|
76 |
article_urls = fetch_article_urls(trends_dic, topic)
|
77 |
+
article_url_str = "\n- ".join(article_urls)
|
78 |
article_docs = [extract_article(url) for url in article_urls]
|
79 |
|
80 |
openai.api_key = os.environ['OPENAI_API_KEY']
|
|
|
157 |
|
158 |
res = sequentialChain({"input_documents": article_docs})
|
159 |
|
160 |
+
summary = [res['translated_summary'] + '\n\nSources:\n' + article_url_str]
|
161 |
generated_res = json.loads(res['output_text'])
|
162 |
|
163 |
tweets = []
|