Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
14 |
"""
|
15 |
-
url = WEBSITES.get(website_name
|
16 |
-
if url
|
17 |
return url
|
18 |
else:
|
19 |
-
return "
|
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:
|