Spaces:
Runtime error
Runtime error
Jayeshbhaal
commited on
Commit
•
793fd68
1
Parent(s):
92e6363
update
Browse files
app.py
CHANGED
@@ -51,7 +51,7 @@ def inference(newssource): #, date):
|
|
51 |
#"<a href=" + "url" + "></a>"link text</a>
|
52 |
description = [entry['description'] for entry in all_articles['articles']]
|
53 |
content = [entry['content'] for entry in all_articles['articles']]
|
54 |
-
url = ["<a href=" + entry['url'] + ">
|
55 |
urlToImage = ["<img src= " + entry['urlToImage']+">" for entry in all_articles['articles']]
|
56 |
|
57 |
print("********************************************************")
|
@@ -65,9 +65,9 @@ def inference(newssource): #, date):
|
|
65 |
dictnews = { 'description' : description, 'content' : content, 'url' : url, 'urlToImage' : urlToImage, 'sentiment' : sentiment}
|
66 |
|
67 |
df = pd.DataFrame.from_dict(dictnews)
|
68 |
-
print("************** df start ****************")
|
69 |
-
print(df)
|
70 |
-
print(f"description : {description}")
|
71 |
print(f"content : {content}")
|
72 |
print(f"url : {url}")
|
73 |
print(f"urlToIm : {urlToImage}")
|
@@ -90,6 +90,7 @@ with gr.Blocks() as demo:
|
|
90 |
with gr.Row():
|
91 |
b1 = gr.Button("Get Positive News")
|
92 |
b2 = gr.Button("Get Negative News")
|
|
|
93 |
|
94 |
with gr.Row():
|
95 |
#sample
|
@@ -98,5 +99,6 @@ with gr.Blocks() as demo:
|
|
98 |
|
99 |
b1.click(fn=inference, inputs=in_newssource, outputs=out_dataframe) #, out_news])
|
100 |
b2.click(fn=inference, inputs=in_newssource, outputs=out_dataframe) #, out_news])
|
101 |
-
|
|
|
102 |
demo.launch(debug=True, show_error=True)
|
|
|
51 |
#"<a href=" + "url" + "></a>"link text</a>
|
52 |
description = [entry['description'] for entry in all_articles['articles']]
|
53 |
content = [entry['content'] for entry in all_articles['articles']]
|
54 |
+
url = ["<a href=" + entry['url'] + ' target="_blank">Click here for the original news article</a>' for entry in all_articles['articles']]
|
55 |
urlToImage = ["<img src= " + entry['urlToImage']+">" for entry in all_articles['articles']]
|
56 |
|
57 |
print("********************************************************")
|
|
|
65 |
dictnews = { 'description' : description, 'content' : content, 'url' : url, 'urlToImage' : urlToImage, 'sentiment' : sentiment}
|
66 |
|
67 |
df = pd.DataFrame.from_dict(dictnews)
|
68 |
+
#print("************** df start ****************")
|
69 |
+
#print(df)
|
70 |
+
#print(f"description : {description}")
|
71 |
print(f"content : {content}")
|
72 |
print(f"url : {url}")
|
73 |
print(f"urlToIm : {urlToImage}")
|
|
|
90 |
with gr.Row():
|
91 |
b1 = gr.Button("Get Positive News")
|
92 |
b2 = gr.Button("Get Negative News")
|
93 |
+
b3 = gr.Button("Get Neutral News")
|
94 |
|
95 |
with gr.Row():
|
96 |
#sample
|
|
|
99 |
|
100 |
b1.click(fn=inference, inputs=in_newssource, outputs=out_dataframe) #, out_news])
|
101 |
b2.click(fn=inference, inputs=in_newssource, outputs=out_dataframe) #, out_news])
|
102 |
+
b2.click(fn=inference, inputs=in_newssource, outputs=out_dataframe) #, out_news])
|
103 |
+
|
104 |
demo.launch(debug=True, show_error=True)
|