Spaces:
Sleeping
Sleeping
import gradio as gr | |
from deliverable2 import * | |
import json | |
# Instantiate the URLValidator class | |
validator = URLValidator() | |
# Define the function for the Gradio app | |
def validate_url(query, url): | |
result = validator.rate_url_validity(query, url) | |
return json.dumps(result, indent=2) | |
# Define multiple queries and URLs | |
queries_urls = [ | |
("Climate change effects", "https://www.nationalgeographic.com/environment/article/climate-change-overview"), | |
("COVID-19 vaccine effectiveness", "https://www.cdc.gov/coronavirus/2019-ncov/vaccines/effectiveness.html"), | |
("Latest AI advancements", "https://www.technologyreview.com/topic/artificial-intelligence"), | |
("Stock market trends", "https://www.bloomberg.com/markets"), | |
("Healthy diet tips", "https://www.healthline.com/nutrition/healthy-eating-tips"), | |
("Space exploration missions", "https://www.nasa.gov/missions"), | |
("Electric vehicle benefits", "https://www.tesla.com/benefits"), | |
("History of the internet", "https://www.history.com/topics/inventions/history-of-the-internet"), | |
("Python programming tutorials", "https://realpython.com"), | |
("Mental health awareness", "https://www.who.int/news-room/fact-sheets/detail/mental-health-strengthening-our-response") | |
] | |
# Create a Gradio interface | |
iface = gr.Interface( | |
fn=validate_url, | |
inputs=["text", "text"], | |
outputs="text", | |
title="URL Credibility Validator", | |
description="Enter a query and a URL to check its credibility." | |
) | |
# Launch the Gradio app | |
iface.launch() | |