AbdullahAj2000 commited on
Commit
f6250e9
·
verified ·
1 Parent(s): dabe8da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -15
app.py CHANGED
@@ -4,6 +4,34 @@ import numpy as np
4
  import cv2
5
  import gradio as gr
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  def load_image_with_cv2(image_path):
9
  img = cv2.imread(image_path)
@@ -29,7 +57,7 @@ def classify_image(input_image,model_selection):
29
  output_name = ort_sess.get_outputs()[0].name
30
  outputs = ort_sess.run(None, {input_name: img_array})
31
  predicted_class_index = np.argmax(outputs[0][0])
32
- classes = ['Ajloun Castle', 'Jerash', 'Jerash', 'Petra', 'Roman amphitheater', 'Roman amphitheater', 'Wadi Rum']
33
  predicted_class = classes[predicted_class_index]
34
  confidence = max(outputs[0][0])
35
 
@@ -47,20 +75,8 @@ def show_preds_image(image_path,model_selection):
47
 
48
  conf = (classify_image(image_path,model_selection))
49
  html = f'<p>petra</p><a href="https://www.gradio.app/docs/examples" target="_blank">"https://www.gradio.app/docs/examples"</a>'
50
- map_link = "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d387195.9481044243!2d-74.25908989999999!3d40.6971494!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c24fa5d33f083b%3A0xc80b8f06e177fe62!2sNew%20York%2C%20NY!5e0!3m2!1sen!2sus!4v1645590913133!5m2!1sen!2sus"
51
- google_map =f'''
52
- <!DOCTYPE html>
53
- <html>
54
- <head>
55
- <title>Map Display</title>
56
- </head>
57
- <body>
58
- <h1>Map Display</h1>
59
- <iframe width="600" height="450" frameborder="0" style="border:0" src="{map_link}" allowfullscreen></iframe>
60
- </body>
61
- </html>
62
- '''
63
-
64
  return img,conf,html,google_map
65
 
66
 
 
4
  import cv2
5
  import gradio as gr
6
 
7
+ def location(place):
8
+ if place == "Ajloun Castle":
9
+ map_link = "https://www.google.com/maps/place/Ajloun+Castle/@32.3252097,35.7274499,15z/data=!4m6!3m5!1s0x151c8888296393d7:0xad15bd4bdbfa4a2c!8m2!3d32.3252097!4d35.7274499!16zL20vMDhrZDN6?entry=ttu"
10
+ elif place == "Jerash":
11
+ map_link = "https://www.google.com/maps/place/The+Archaeological+Site+of+Jerash/@32.2756771,35.8898159,15.75z/data=!4m15!1m8!3m7!1s0x151c802ff49ac08d:0x876c24b1cbded302!2sJerash!3b1!8m2!3d32.2746515!4d35.8960765!16zL20vMDE5NTlk!3m5!1s0x151c8048588ecc75:0xc3bc8fe9ac19669e!8m2!3d32.2787781!4d35.8893265!16s%2Fg%2F1hc3jphgx?entry=ttu"
12
+ elif place == "Petra":
13
+ map_link = "https://www.google.com/maps/place/The+Treasury/@30.3200019,35.4665137,14.75z/data=!4m15!1m8!3m7!1s0x15016930021ab6b1:0xe43a697bc3a3e0b9!2sWadi+Musa!3b1!8m2!3d30.3216354!4d35.4801251!16s%2Fm%2F03nx74h!3m5!1s0x15016eeb79d3cf39:0xa40550ba81476059!8m2!3d30.3221392!4d35.4517457!16zL20vMGZuanlw?entry=ttu"
14
+ elif place == "Roman amphitheater":
15
+ map_link = "https://www.google.com/maps/place/Roman+Theater/@31.9517165,35.9368315,17z/data=!3m1!4b1!4m6!3m5!1s0x151ca07139c70a21:0xc5b2f8903093b109!8m2!3d31.9517165!4d35.9394064!16zL20vMGdwamY2?entry=ttu"
16
+ elif place == "Umm Qais":
17
+ map_link = "https://www.google.com/maps/place/Umm+Qays/@32.6625169,35.6698552,15z/data=!4m15!1m8!3m7!1s0x151c6d07287b7199:0x96d0d420e01bf0b1!2sUmm+Qais!3b1!8m2!3d32.6543534!4d35.6880516!16zL20vMDRfMnZq!3m5!1s0x151c6c5f1e3deb1b:0x73f5d4d2d68f09a4!8m2!3d32.6556353!4d35.6780218!16s%2Fg%2F1tcvlmk_?entry=ttu"
18
+ elif place == "Wadi Rum":
19
+ map_link = "https://www.google.com/maps/search/wadi+rum/@29.556416,35.3964418,14z/data=!3m1!4b1?entry=ttu"
20
+
21
+ google_map =f'''
22
+ <!DOCTYPE html>
23
+ <html>
24
+ <head>
25
+ <title>Map Display</title>
26
+ </head>
27
+ <body>
28
+ <h1>Map Display</h1>
29
+ <iframe width="600" height="450" frameborder="0" style="border:0" src="{map_link}" allowfullscreen></iframe>
30
+ </body>
31
+ </html>
32
+ '''
33
+ return google_map
34
+
35
 
36
  def load_image_with_cv2(image_path):
37
  img = cv2.imread(image_path)
 
57
  output_name = ort_sess.get_outputs()[0].name
58
  outputs = ort_sess.run(None, {input_name: img_array})
59
  predicted_class_index = np.argmax(outputs[0][0])
60
+ classes = ['Ajloun Castle', 'Jerash', 'Jerash', 'Petra', 'Roman amphitheater', 'Umm Qais', 'Wadi Rum']
61
  predicted_class = classes[predicted_class_index]
62
  confidence = max(outputs[0][0])
63
 
 
75
 
76
  conf = (classify_image(image_path,model_selection))
77
  html = f'<p>petra</p><a href="https://www.gradio.app/docs/examples" target="_blank">"https://www.gradio.app/docs/examples"</a>'
78
+
79
+ google_map = location(mux_value)
 
 
 
 
 
 
 
 
 
 
 
 
80
  return img,conf,html,google_map
81
 
82