Spaces:
Runtime error
Runtime error
Abubakar Abid
commited on
Commit
·
ff9740a
1
Parent(s):
b62839b
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio.mix import Parallel, Series
|
3 |
+
import torch
|
4 |
+
|
5 |
+
# Images
|
6 |
+
torch.hub.download_url_to_file('http://images.cocodataset.org/val2017/000000039769.jpg', 'cat.jpg')
|
7 |
+
torch.hub.download_url_to_file('https://cdn.pixabay.com/photo/2015/06/08/15/02/pug-801826_1280.jpg', 'dog.jpg')
|
8 |
+
|
9 |
+
io1 = gr.Interface.load("huggingface/google/vit-base-patch16-224")
|
10 |
+
io2 = gr.Interface.load("huggingface/facebook/deit-base-distilled-patch16-224")
|
11 |
+
|
12 |
+
title = "VIT and Deit Parallel Demo"
|
13 |
+
description = "demo for Google VIT and Facebook Deit using Gradio parallel and Huggingface Models. Upload an image or click an example image to use. Read more at the links below"
|
14 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2010.11929'>VIT</a> | <a href='https://github.com/google-research/vision_transformer'>Vision Transformer Github</a> | <a href='https://arxiv.org/abs/2012.12877'>Deit</a>| <a href='https://github.com/facebookresearch/deit'>Deit Github</a> | <a href='https://gradio.app/blog/using-huggingface-models'>Gradio Blog</a></p>"
|
15 |
+
|
16 |
+
examples = [['cat.jpg'], ['dog.jpg']]
|
17 |
+
Parallel(io1, io2, title=title, description=description, article=article, examples=examples).launch()
|