Charmainemahachi
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,17 @@ Automatically generated by Colaboratory.
|
|
6 |
Original file is located at
|
7 |
https://colab.research.google.com/drive/1kJdblTHuqDn8HCKTuEpoApkN05Gzjpot
|
8 |
"""
|
|
|
9 |
|
10 |
-
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
|
16 |
#from huggingface_hub import notebook_login
|
17 |
|
|
|
18 |
#notebook_login()
|
19 |
|
20 |
import gradio as gr
|
@@ -51,7 +53,8 @@ def filter_caption(object_detection_results):
|
|
51 |
|
52 |
#function to filter the generated caption checking whether human, cats and/or dogs are present using the generated caption
|
53 |
#initial method considered
|
54 |
-
def
|
|
|
55 |
#If any of these keywords are present, True is returned
|
56 |
keywords = ["dog","dogs", "cat","cats", "human","humans","man", "men","woman","women","child","children","adult","adults","person"]
|
57 |
caption = caption.lower()
|
|
|
6 |
Original file is located at
|
7 |
https://colab.research.google.com/drive/1kJdblTHuqDn8HCKTuEpoApkN05Gzjpot
|
8 |
"""
|
9 |
+
pip install transformers
|
10 |
|
11 |
+
pip install gradio #used for creating the demo
|
12 |
|
13 |
+
pip install timm
|
14 |
|
15 |
+
pip install huggingface_hub
|
16 |
|
17 |
#from huggingface_hub import notebook_login
|
18 |
|
19 |
+
|
20 |
#notebook_login()
|
21 |
|
22 |
import gradio as gr
|
|
|
53 |
|
54 |
#function to filter the generated caption checking whether human, cats and/or dogs are present using the generated caption
|
55 |
#initial method considered
|
56 |
+
def
|
57 |
+
filter(caption):
|
58 |
#If any of these keywords are present, True is returned
|
59 |
keywords = ["dog","dogs", "cat","cats", "human","humans","man", "men","woman","women","child","children","adult","adults","person"]
|
60 |
caption = caption.lower()
|