Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import gradio as gr
|
|
4 |
os.system("git clone https://github.com/AK391/TokenCut.git")
|
5 |
os.chdir("TokenCut")
|
6 |
|
|
|
|
|
7 |
def inference(img):
|
8 |
os.system("python main_tokencut.py --image_path "+img+" --visualize all")
|
9 |
return "./outputs/TokenCut-vit_small16_k/test_TokenCut_attn.jpg","./outputs/TokenCut-vit_small16_k/test_TokenCut_pred.jpg"
|
@@ -13,5 +15,5 @@ description="Gradio demo for TokenCut: Self-Supervised Transformers for Unsuperv
|
|
13 |
|
14 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2202.11539' target='_blank'>Self-Supervised Transformers for Unsupervised Object Discovery using Normalized Cut</a> | <a href='https://github.com/YangtaoWANG95/TokenCut' target='_blank'>Github Repo</a></p>"
|
15 |
|
16 |
-
examples=[['dog.
|
17 |
gr.Interface(inference,gr.inputs.Image(type="filepath"),[gr.outputs.Image(type="file"),gr.outputs.Image(type="file")],title=title,description=description,article=article,examples=examples).launch()
|
|
|
4 |
os.system("git clone https://github.com/AK391/TokenCut.git")
|
5 |
os.chdir("TokenCut")
|
6 |
|
7 |
+
os.system("wget https://i.imgur.com/G4wpITa.jpg -O dog.jpg")
|
8 |
+
|
9 |
def inference(img):
|
10 |
os.system("python main_tokencut.py --image_path "+img+" --visualize all")
|
11 |
return "./outputs/TokenCut-vit_small16_k/test_TokenCut_attn.jpg","./outputs/TokenCut-vit_small16_k/test_TokenCut_pred.jpg"
|
|
|
15 |
|
16 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2202.11539' target='_blank'>Self-Supervised Transformers for Unsupervised Object Discovery using Normalized Cut</a> | <a href='https://github.com/YangtaoWANG95/TokenCut' target='_blank'>Github Repo</a></p>"
|
17 |
|
18 |
+
examples=[['dog.jpg']]
|
19 |
gr.Interface(inference,gr.inputs.Image(type="filepath"),[gr.outputs.Image(type="file"),gr.outputs.Image(type="file")],title=title,description=description,article=article,examples=examples).launch()
|