Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def explain_web_search(query): | |
| explanations = { | |
| "what is web search": """ | |
| A web search is the process of using an online search engine to locate documents, web pages, videos, images, or other digital content on the internet. Popular engines include Google, Bing, and Yahoo. It allows quick access to information, comparison of sources, and saving search history. | |
| """, | |
| "search engines": """ | |
| Search engines like Google, Bing, Yahoo, Ask.com, and AOL.com crawl the web to index content and provide real-time results based on user queries. They present results as URLs with abstracts and can include images, videos, and data from databases. | |
| """, | |
| "how to search": """ | |
| To search: Navigate to a search engine in your browser (e.g., Google in Chrome), type keywords, and press Enter. Use the address bar for direct searches. Refine queries if needed for better results. Search suggestions help improve accuracy. | |
| """, | |
| "benefits": """ | |
| Web search is fast, convenient, and comprehensive. It enables finding exact information, comparing sources, and accessing saved history. Privacy-focused engines like those with EuroPriSe certification offer secure searching without tracking. | |
| """, | |
| "default": """ | |
| For general queries, start with keywords in Google or Bing. Learn more about search engines and techniques for effective results. | |
| """ | |
| } | |
| key = next((k for k in explanations if k in query.lower()), "default") | |
| return explanations[key] | |
| with gr.Blocks(title="Web Search Guide") as demo: | |
| gr.Markdown("# Web Search Guide") | |
| gr.Markdown(""" | |
| Learn about web searching! Enter a query related to web search (e.g., 'what is web search', 'search engines', 'how to search', 'benefits') to get an explanation. | |
| """) | |
| query_input = gr.Textbox(label="Your Query", placeholder="What is web search?") | |
| output = gr.Markdown(label="Explanation") | |
| examples = gr.Examples( | |
| examples=[ | |
| ["what is web search"], | |
| ["search engines"], | |
| ["how to search"], | |
| ["benefits"] | |
| ], | |
| inputs=query_input | |
| ) | |
| query_input.submit(explain_web_search, query_input, output) | |
| if __name__ == "__main__": | |
| demo.launch() |