Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,6 +70,14 @@ class WorldExplorerAI:
|
|
| 70 |
"language": "English, French",
|
| 71 |
"continent": "North America",
|
| 72 |
"fact": "Has the longest coastline in the world."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
}
|
| 74 |
}
|
| 75 |
|
|
@@ -86,7 +94,8 @@ class WorldExplorerAI:
|
|
| 86 |
"uk": {"current": "Rishi Sunak", "title": "Prime Minister"},
|
| 87 |
"canada": {"current": "Justin Trudeau", "title": "Prime Minister"},
|
| 88 |
"australia": {"current": "Anthony Albanese", "title": "Prime Minister"},
|
| 89 |
-
"japan": {"current": "Fumio Kishida", "title": "Prime Minister"}
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
def setup_nature(self):
|
|
@@ -98,7 +107,9 @@ class WorldExplorerAI:
|
|
| 98 |
"niagara falls": "Niagara Falls has the highest flow rate of any waterfall in North America.",
|
| 99 |
"sahara desert": "The Sahara Desert is the largest hot desert in the world, covering most of North Africa.",
|
| 100 |
"grand canyon": "The Grand Canyon is 446 km long, up to 29 km wide, and attains a depth of over 1,800 meters.",
|
| 101 |
-
"northern lights": "The Northern Lights (Aurora Borealis) are caused by collisions between electrically charged particles from the sun."
|
|
|
|
|
|
|
| 102 |
}
|
| 103 |
|
| 104 |
def setup_animals(self):
|
|
@@ -114,7 +125,9 @@ class WorldExplorerAI:
|
|
| 114 |
"eagle": "Bald eagles can spot a fish from up to a mile away and can reach speeds of 100 mph when diving.",
|
| 115 |
"ostrich": "The ostrich is the fastest bird on land, reaching speeds up to 43 mph (70 km/h).",
|
| 116 |
"giraffe": "Giraffes are the tallest land animals, with necks that can be up to 6 feet long.",
|
| 117 |
-
"kangaroo": "Kangaroos can jump up to 30 feet in one leap and can reach speeds of 35 mph."
|
|
|
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
def setup_records(self):
|
|
@@ -129,7 +142,8 @@ class WorldExplorerAI:
|
|
| 129 |
"largest country": "Russia is the largest country by area, covering 17.1 million square kilometers.",
|
| 130 |
"most populous country": "China is the most populous country with over 1.4 billion people.",
|
| 131 |
"highest mountain": "Mount Everest is the highest mountain above sea level at 8,848 meters.",
|
| 132 |
-
"longest river": "The Nile River is the longest river in the world at 6,650 km."
|
|
|
|
| 133 |
}
|
| 134 |
|
| 135 |
def find_match(self, query, database):
|
|
@@ -311,7 +325,7 @@ with gr.Blocks(css=custom_css, title="World Explorer AI") as demo:
|
|
| 311 |
with gr.Row():
|
| 312 |
msg = gr.Textbox(
|
| 313 |
label="Ask me anything about our world",
|
| 314 |
-
placeholder="Type your question here... (e.g., 'Tell me about
|
| 315 |
scale=4
|
| 316 |
)
|
| 317 |
submit_btn = gr.Button("Ask", scale=1, variant="primary")
|
|
@@ -323,14 +337,14 @@ with gr.Blocks(css=custom_css, title="World Explorer AI") as demo:
|
|
| 323 |
with gr.Accordion("💡 Quick Questions to Try", open=True):
|
| 324 |
examples = gr.Examples(
|
| 325 |
examples=[
|
| 326 |
-
"Who is the president of
|
| 327 |
-
"Tell me about
|
| 328 |
"What is the fastest animal?",
|
| 329 |
-
"Tell me about
|
| 330 |
-
"Who leads
|
| 331 |
"What is the largest country?",
|
| 332 |
-
"Tell me about
|
| 333 |
-
"What is
|
| 334 |
],
|
| 335 |
inputs=msg,
|
| 336 |
label="Click any question to try it!"
|
|
@@ -338,10 +352,10 @@ with gr.Blocks(css=custom_css, title="World Explorer AI") as demo:
|
|
| 338 |
|
| 339 |
with gr.Accordion("📚 What I Know About", open=False):
|
| 340 |
gr.Markdown("""
|
| 341 |
-
**Countries**: USA, France, Japan, Brazil, India, Australia, Canada
|
| 342 |
**Leaders**: Presidents and Prime Ministers of various countries
|
| 343 |
-
**Animals**: Cheetah, Elephant, Tiger, Blue Whale, Panda, Eagle,
|
| 344 |
-
**Nature**: Amazon, Great Barrier Reef, Mount Everest, Sahara Desert
|
| 345 |
**Records**: Fastest animals, largest countries, highest mountains
|
| 346 |
""")
|
| 347 |
|
|
|
|
| 70 |
"language": "English, French",
|
| 71 |
"continent": "North America",
|
| 72 |
"fact": "Has the longest coastline in the world."
|
| 73 |
+
},
|
| 74 |
+
"pakistan": {
|
| 75 |
+
"name": "Pakistan",
|
| 76 |
+
"capital": "Islamabad",
|
| 77 |
+
"population": "240 million",
|
| 78 |
+
"language": "Urdu, English",
|
| 79 |
+
"continent": "Asia",
|
| 80 |
+
"fact": "Home to the world's second-highest mountain K2 and has the world's largest deep sea port in Gwadar."
|
| 81 |
}
|
| 82 |
}
|
| 83 |
|
|
|
|
| 94 |
"uk": {"current": "Rishi Sunak", "title": "Prime Minister"},
|
| 95 |
"canada": {"current": "Justin Trudeau", "title": "Prime Minister"},
|
| 96 |
"australia": {"current": "Anthony Albanese", "title": "Prime Minister"},
|
| 97 |
+
"japan": {"current": "Fumio Kishida", "title": "Prime Minister"},
|
| 98 |
+
"pakistan": {"current": "Asif Ali Zardari", "title": "President"}
|
| 99 |
}
|
| 100 |
|
| 101 |
def setup_nature(self):
|
|
|
|
| 107 |
"niagara falls": "Niagara Falls has the highest flow rate of any waterfall in North America.",
|
| 108 |
"sahara desert": "The Sahara Desert is the largest hot desert in the world, covering most of North Africa.",
|
| 109 |
"grand canyon": "The Grand Canyon is 446 km long, up to 29 km wide, and attains a depth of over 1,800 meters.",
|
| 110 |
+
"northern lights": "The Northern Lights (Aurora Borealis) are caused by collisions between electrically charged particles from the sun.",
|
| 111 |
+
"k2": "K2, also known as Mount Godwin-Austen, is the second-highest mountain on Earth at 8,611 meters, located on the China-Pakistan border.",
|
| 112 |
+
"indus river": "The Indus River is one of the longest rivers in Asia, flowing through Pakistan and playing a vital role in the country's agriculture."
|
| 113 |
}
|
| 114 |
|
| 115 |
def setup_animals(self):
|
|
|
|
| 125 |
"eagle": "Bald eagles can spot a fish from up to a mile away and can reach speeds of 100 mph when diving.",
|
| 126 |
"ostrich": "The ostrich is the fastest bird on land, reaching speeds up to 43 mph (70 km/h).",
|
| 127 |
"giraffe": "Giraffes are the tallest land animals, with necks that can be up to 6 feet long.",
|
| 128 |
+
"kangaroo": "Kangaroos can jump up to 30 feet in one leap and can reach speeds of 35 mph.",
|
| 129 |
+
"markhor": "The markhor is Pakistan's national animal, a large wild goat species found in the mountains of Central Asia.",
|
| 130 |
+
"snow leopard": "Snow leopards are found in the northern mountainous regions of Pakistan and are known for their beautiful thick fur."
|
| 131 |
}
|
| 132 |
|
| 133 |
def setup_records(self):
|
|
|
|
| 142 |
"largest country": "Russia is the largest country by area, covering 17.1 million square kilometers.",
|
| 143 |
"most populous country": "China is the most populous country with over 1.4 billion people.",
|
| 144 |
"highest mountain": "Mount Everest is the highest mountain above sea level at 8,848 meters.",
|
| 145 |
+
"longest river": "The Nile River is the longest river in the world at 6,650 km.",
|
| 146 |
+
"second highest mountain": "K2 is the second-highest mountain in the world at 8,611 meters, located in Pakistan."
|
| 147 |
}
|
| 148 |
|
| 149 |
def find_match(self, query, database):
|
|
|
|
| 325 |
with gr.Row():
|
| 326 |
msg = gr.Textbox(
|
| 327 |
label="Ask me anything about our world",
|
| 328 |
+
placeholder="Type your question here... (e.g., 'Tell me about Pakistan', 'Who is the president of Pakistan?')",
|
| 329 |
scale=4
|
| 330 |
)
|
| 331 |
submit_btn = gr.Button("Ask", scale=1, variant="primary")
|
|
|
|
| 337 |
with gr.Accordion("💡 Quick Questions to Try", open=True):
|
| 338 |
examples = gr.Examples(
|
| 339 |
examples=[
|
| 340 |
+
"Who is the president of Pakistan?",
|
| 341 |
+
"Tell me about Pakistan",
|
| 342 |
"What is the fastest animal?",
|
| 343 |
+
"Tell me about K2 mountain",
|
| 344 |
+
"Who leads USA?",
|
| 345 |
"What is the largest country?",
|
| 346 |
+
"Tell me about markhor",
|
| 347 |
+
"What is the Indus River?"
|
| 348 |
],
|
| 349 |
inputs=msg,
|
| 350 |
label="Click any question to try it!"
|
|
|
|
| 352 |
|
| 353 |
with gr.Accordion("📚 What I Know About", open=False):
|
| 354 |
gr.Markdown("""
|
| 355 |
+
**Countries**: USA, France, Japan, Brazil, India, Australia, Canada, Pakistan
|
| 356 |
**Leaders**: Presidents and Prime Ministers of various countries
|
| 357 |
+
**Animals**: Cheetah, Elephant, Tiger, Blue Whale, Panda, Eagle, Markhor, Snow Leopard
|
| 358 |
+
**Nature**: Amazon, Great Barrier Reef, Mount Everest, K2, Sahara Desert, Indus River
|
| 359 |
**Records**: Fastest animals, largest countries, highest mountains
|
| 360 |
""")
|
| 361 |
|