Spaces:
Runtime error
Runtime error
Jayeshbhaal
commited on
Commit
•
cb360ef
1
Parent(s):
6e8b49f
update
Browse files
app.py
CHANGED
@@ -48,10 +48,10 @@ def inference(newssource): #, date):
|
|
48 |
sentiment = sentiment_tophead
|
49 |
all_articles = all_top_headlines
|
50 |
|
51 |
-
#"<
|
52 |
description = [entry['description'] for entry in all_articles['articles']]
|
53 |
content = [entry['content'] for entry in all_articles['articles']]
|
54 |
-
url = [entry['url'] for entry in all_articles['articles']]
|
55 |
urlToImage = ["<img src= " + entry['urlToImage']+">" for entry in all_articles['articles']]
|
56 |
|
57 |
print("********************************************************")
|
@@ -78,7 +78,7 @@ def inference(newssource): #, date):
|
|
78 |
if dictnews['urlToImage'][0] is not None :
|
79 |
html_out = "<img src= " + dictnews['urlToImage'][0] + ">"
|
80 |
print(f"html_out is : {html_out}")
|
81 |
-
return df
|
82 |
|
83 |
|
84 |
#Gradio Blocks
|
@@ -93,10 +93,10 @@ with gr.Blocks() as demo:
|
|
93 |
|
94 |
with gr.Row():
|
95 |
#sample
|
96 |
-
out_news = gr.HTML(label="First News Link", show_label=True)
|
97 |
out_dataframe = gr.Dataframe(wrap=True, datatype = ["str", "str", "markdown", "markdown", "str"])
|
98 |
|
99 |
-
b1.click(fn=inference, inputs=in_newssource, outputs=
|
100 |
-
b2.click(fn=inference, inputs=in_newssource, outputs=
|
101 |
|
102 |
demo.launch(debug=True, show_error=True)
|
|
|
48 |
sentiment = sentiment_tophead
|
49 |
all_articles = all_top_headlines
|
50 |
|
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'] + "></a>" for entry in all_articles['articles']]
|
55 |
urlToImage = ["<img src= " + entry['urlToImage']+">" for entry in all_articles['articles']]
|
56 |
|
57 |
print("********************************************************")
|
|
|
78 |
if dictnews['urlToImage'][0] is not None :
|
79 |
html_out = "<img src= " + dictnews['urlToImage'][0] + ">"
|
80 |
print(f"html_out is : {html_out}")
|
81 |
+
return df #, html_out
|
82 |
|
83 |
|
84 |
#Gradio Blocks
|
|
|
93 |
|
94 |
with gr.Row():
|
95 |
#sample
|
96 |
+
#out_news = gr.HTML(label="First News Link", show_label=True)
|
97 |
out_dataframe = gr.Dataframe(wrap=True, datatype = ["str", "str", "markdown", "markdown", "str"])
|
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)
|