Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,37 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
import json
|
4 |
|
5 |
# Instantiate the URLValidator class
|
6 |
validator = URLValidator()
|
7 |
|
8 |
-
|
9 |
-
|
|
|
10 |
return json.dumps(result, indent=2)
|
11 |
|
12 |
-
# Define
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
iface = gr.Interface(
|
14 |
fn=validate_url,
|
15 |
-
inputs=[
|
16 |
-
|
17 |
-
gr.Textbox(label="Enter URL to validate")
|
18 |
-
],
|
19 |
-
outputs=gr.Textbox(label="Validation Result"),
|
20 |
title="URL Credibility Validator",
|
21 |
-
description="Enter a query and a URL to check its credibility
|
22 |
)
|
23 |
|
24 |
-
# Launch the app
|
25 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from deliverable2 import *
|
3 |
import json
|
4 |
|
5 |
# Instantiate the URLValidator class
|
6 |
validator = URLValidator()
|
7 |
|
8 |
+
# Define the function for the Gradio app
|
9 |
+
def validate_url(query, url):
|
10 |
+
result = validator.rate_url_validity(query, url)
|
11 |
return json.dumps(result, indent=2)
|
12 |
|
13 |
+
# Define multiple queries and URLs
|
14 |
+
queries_urls = [
|
15 |
+
("Climate change effects", "https://www.nationalgeographic.com/environment/article/climate-change-overview"),
|
16 |
+
("COVID-19 vaccine effectiveness", "https://www.cdc.gov/coronavirus/2019-ncov/vaccines/effectiveness.html"),
|
17 |
+
("Latest AI advancements", "https://www.technologyreview.com/topic/artificial-intelligence"),
|
18 |
+
("Stock market trends", "https://www.bloomberg.com/markets"),
|
19 |
+
("Healthy diet tips", "https://www.healthline.com/nutrition/healthy-eating-tips"),
|
20 |
+
("Space exploration missions", "https://www.nasa.gov/missions"),
|
21 |
+
("Electric vehicle benefits", "https://www.tesla.com/benefits"),
|
22 |
+
("History of the internet", "https://www.history.com/topics/inventions/history-of-the-internet"),
|
23 |
+
("Python programming tutorials", "https://realpython.com"),
|
24 |
+
("Mental health awareness", "https://www.who.int/news-room/fact-sheets/detail/mental-health-strengthening-our-response")
|
25 |
+
]
|
26 |
+
|
27 |
+
# Create a Gradio interface
|
28 |
iface = gr.Interface(
|
29 |
fn=validate_url,
|
30 |
+
inputs=["text", "text"],
|
31 |
+
outputs="text",
|
|
|
|
|
|
|
32 |
title="URL Credibility Validator",
|
33 |
+
description="Enter a query and a URL to check its credibility."
|
34 |
)
|
35 |
|
36 |
+
# Launch the Gradio app
|
37 |
iface.launch()
|