AINovice2005 commited on
Commit
09daeb6
·
verified ·
1 Parent(s): 2e0cbec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import gradio as gr
2
 
3
-
4
  # A dictionary to store website names and their URLs
5
  WEBSITES = {
6
  "Website 1": "https://aman.ai/primers/ai/top-30-papers/",
@@ -10,13 +9,13 @@ WEBSITES = {
10
  def open_website(website_name):
11
  """
12
  Function to retrieve the website URL from the dictionary.
13
- It includes validation to ensure the URL is correct.
14
  """
15
- url = WEBSITES.get(website_name, None)
16
- if url and validators.url(url):
17
  return url
18
  else:
19
- return "Invalid URL or Website not found."
20
 
21
  # Define the Gradio interface
22
  with gr.Blocks() as demo:
 
1
  import gradio as gr
2
 
 
3
  # A dictionary to store website names and their URLs
4
  WEBSITES = {
5
  "Website 1": "https://aman.ai/primers/ai/top-30-papers/",
 
9
  def open_website(website_name):
10
  """
11
  Function to retrieve the website URL from the dictionary.
12
+ Handles cases where the website name doesn't exist.
13
  """
14
+ url = WEBSITES.get(website_name)
15
+ if url:
16
  return url
17
  else:
18
+ return "Website not found."
19
 
20
  # Define the Gradio interface
21
  with gr.Blocks() as demo: