Clementapa commited on
Commit
fd3c45b
1 Parent(s): 57ecc83
Files changed (3) hide show
  1. README.md +3 -3
  2. app.py +39 -36
  3. style.css +0 -50
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
  title: Orang Outan Image Video Detection
3
- emoji: 👀
4
- colorFrom: red
5
- colorTo: blue
6
  sdk: gradio
7
  sdk_version: 4.1.1
8
  app_file: app.py
 
1
  ---
2
  title: Orang Outan Image Video Detection
3
+ emoji: 🦧
4
+ colorFrom: green
5
+ colorTo: green
6
  sdk: gradio
7
  sdk_version: 4.1.1
8
  app_file: app.py
app.py CHANGED
@@ -7,7 +7,22 @@ from PIL import Image
7
  from ultralytics import YOLO
8
 
9
  MARKDOWN = """
10
- # Orang Outan Detection
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  """
12
  EXAMPLES = []
13
 
@@ -49,42 +64,30 @@ def inference(image_rgb_pil: Image.Image, confidence: float) -> List[Image.Image
49
  )
50
 
51
 
52
- def run_demo():
53
- custom_theme = gr.themes.Soft(primary_hue="blue").set(
54
- button_secondary_background_fill="*neutral_100",
55
- button_secondary_background_fill_hover="*neutral_200",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  )
57
 
58
- with gr.Blocks(theme=custom_theme, css="style.css") as demo:
59
- gr.Markdown(MARKDOWN)
60
-
61
- with gr.Row():
62
- with gr.Column():
63
- input_image = gr.Image(image_mode="RGB", type="pil", height=500)
64
- confidence_slider = gr.Slider(
65
- label="Confidence", minimum=0.1, maximum=1.0, step=0.05, value=0.6
66
- )
67
- submit_button = gr.Button("Submit")
68
- output_image = gr.Image(label="Results", type="pil")
69
-
70
- # with gr.Row():
71
- # gr.Examples(
72
- # examples=EXAMPLES,
73
- # fn=inference,
74
- # inputs=[input_image, prompt_text, confidence_slider],
75
- # outputs=[gallery],
76
- # cache_examples=True,
77
- # run_on_click=True
78
- # )
79
-
80
- submit_button.click(
81
- inference,
82
- inputs=[input_image, confidence_slider],
83
- outputs=output_image,
84
- queue=True,
85
- )
86
- demo.queue(max_size=20, api_open=False).launch()
87
-
88
 
89
  if __name__ == "__main__":
90
- run_demo()
 
7
  from ultralytics import YOLO
8
 
9
  MARKDOWN = """
10
+ <h1 style="text-align: center;">YOLO Orang Outan Detection 🦧🔍 </h1>
11
+
12
+ ## About the model 👁️
13
+ This is a demo for my YOLOv8 nano trained for orang outan detection.\\
14
+ The model was trained using [this dataset](https://images.cv/dataset/orangutan-image-classification-dataset)
15
+ for orang outan images and [this dataset](https://www.kaggle.com/datasets/slothkong/10-monkey-species/data) as background images. Annotations were obtained using zero shot detection method GroundingDino.\\
16
+
17
+ The code can be found on my github repository: https://github.com/clementapa/orang-outan-image-video-detection.
18
+
19
+ ## About the orang outans 🦧
20
+ Because to habitat destruction, illicit poaching, and the pet trade, orangutans are in danger of going extinct. Their natural habitat has been significantly reduced by deforestation and the growth of palm oil plantations. Adult orangutans are occasionally sought for their body parts, and they are frequently captured and sold as pets. Climate change and disease are also taking a toll on their populations. Furthermore, it is concerning to note that they are limited to Borneo and Sumatra, two places on Earth. Sustainable practises and conservation initiatives are crucial to preventing the permanent extinction of these amazing animals.
21
+
22
+ ## AI for good 🌍
23
+ Artificial Intelligence (AI) has unquestionable power in the realm of innovation and technology. Even though artificial intelligence (AI) has frequently been used for commercial advantage, it is important to stress that AI can also be used for more noble purposes, such as protecting the environment and the planet's future. We can build a more promising and sustainable future if we reorient AI's focus from business to improving our planet.
24
+
25
+
26
  """
27
  EXAMPLES = []
28
 
 
64
  )
65
 
66
 
67
+ custom_theme = gr.themes.Soft(primary_hue="blue").set(
68
+ button_secondary_background_fill="*neutral_100",
69
+ button_secondary_background_fill_hover="*neutral_200",
70
+ )
71
+
72
+ with gr.Blocks(theme=custom_theme, css="style.css") as demo:
73
+ gr.Markdown(MARKDOWN)
74
+
75
+ with gr.Row():
76
+ with gr.Column():
77
+ input_image = gr.Image(image_mode="RGB", type="pil", height=500)
78
+ confidence_slider = gr.Slider(
79
+ label="Confidence", minimum=0.1, maximum=1.0, step=0.05, value=0.6
80
+ )
81
+ submit_button = gr.Button("Let's find orang outans 🦧 !")
82
+ output_image = gr.Image(label="Results", type="pil")
83
+
84
+ submit_button.click(
85
+ inference,
86
+ inputs=[input_image, confidence_slider],
87
+ outputs=output_image,
88
+ queue=True,
89
  )
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  if __name__ == "__main__":
93
+ demo.queue(max_size=20, api_open=False).launch()
style.css CHANGED
@@ -3,56 +3,6 @@
3
  /* Horizontally center the content */
4
  }
5
 
6
- #share-btn-container {
7
- padding-left: 0.5rem !important;
8
- padding-right: 0.5rem !important;
9
- background-color: #000000;
10
- justify-content: center;
11
- align-items: center;
12
- border-radius: 9999px !important;
13
- max-width: 13rem;
14
- margin-left: auto;
15
- }
16
-
17
- div#share-btn-container>div {
18
- flex-direction: row;
19
- background: black;
20
- align-items: center
21
- }
22
-
23
- #share-btn-container:hover {
24
- background-color: #060606
25
- }
26
-
27
- #share-btn {
28
- all: initial;
29
- color: #ffffff;
30
- font-weight: 600;
31
- cursor: pointer;
32
- font-family: 'IBM Plex Sans', sans-serif;
33
- margin-left: 0.5rem !important;
34
- padding-top: 0.5rem !important;
35
- padding-bottom: 0.5rem !important;
36
- right: 0;
37
- }
38
-
39
- #share-btn * {
40
- all: unset
41
- }
42
-
43
- #share-btn-container div:nth-child(-n+2) {
44
- width: auto !important;
45
- min-height: 0px !important;
46
- }
47
-
48
- #share-btn-container .wrap {
49
- display: none !important
50
- }
51
-
52
- #share-btn-container.hidden {
53
- display: none !important
54
- }
55
-
56
  #duplicate-button {
57
  margin-left: auto;
58
  color: #fff;
 
3
  /* Horizontally center the content */
4
  }
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  #duplicate-button {
7
  margin-left: auto;
8
  color: #fff;