-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Huggingface Spaces #8
Comments
Thanks for your interesting suggestions! Since these days are the Chinese spring festival, I will finish a web demo when free. |
@AK391 I have created a demo for image classification followed your code (https://huggingface.co/spaces/Andy1621/uniformer_image_demo). I will try to add video demo later ~~ |
@Andy1621 Thanks, I opened a PR #9 to add a link/badge to the demo in the readme. Also for outputs types label can be used here https://gradio.app/docs/#o_label |
@AK391 I have create a video demo and merge the PR! Thanks for your interesting suggestion! |
@AK391 How can I set the font size of |
@Andy1621 thanks video demo look great, you can try using custom css https://gradio.app/docs/#interface for the font size |
@Andy1621 also I created a org for https://huggingface.co/Sense-X SenseTime X-Lab (similar to github https://github.com/Sense-X), you can move all your spaces+models+datasets here similar to how you do on github, just send a invite request and I can accept it |
@AK391 Look great! |
@AK391 BTW, I have sent a request to the organization you created. Would you please accept it and give me the corresponding permission to verify the organization? |
@Andy1621 Thanks, approved request to adding to organization. Regarding adding models, there is a step-by-step guide for adding your model to the Hugging Face Hub. Once models are added they can be used in spaces in two ways, one like here https://huggingface.co/spaces/akhaliq/JoJoGAN by using
and if the inference api is setup they can be added using
like here https://huggingface.co/spaces/akhaliq/xm_transformer_600m |
@AK391 Thanks for your patience. I will try to add some models today. |
@Andy1621 Great thanks, also once a model is added to the hub it can be easily turned in a Gradio space using, for example
see |
@AK391 Thanks! But how does it work? It seems that such import gradio as gr
gr.Interface.Load("huggingface/Sense-X/uniformer_image").launch() gradio.Interface(
self, fn, inputs=None, outputs=None, examples=None, examples_per_page=10,
live=False, layout="unaligned", interpretation=None, num_shap=2.0, theme=None,
title=None, description=None, article=None, thumbnail=None, css=None,
allow_screenshot=True, allow_flagging=None, flagging_options=None, flagging_dir="flagged"
)
Should I change the code for One more question, since I have not pull from transformers import AutoFeatureExtractor, SwinForImageClassification
feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model = SwinForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224") thus I suggest others used as in model card: create model => load model by |
@AK391 Thanks! def get_huggingface_interface(model_name, api_key, alias):
model_url = "https://huggingface.co/{}".format(model_name)
api_url = "https://api-inference.huggingface.co/models/{}".format(model_name)
print("Fetching model from: {}".format(model_url))
if api_key is not None:
headers = {"Authorization": f"Bearer {api_key}"}
else:
headers = {}
# Checking if model exists, and if so, it gets the pipeline
response = requests.request("GET", api_url, headers=headers)
assert response.status_code == 200, "Invalid model name or src"
p = response.json().get("pipeline_tag") The followed {
'id': 'microsoft/swin-tiny-patch4-window7-224',
'modelId': 'microsoft/swin-tiny-patch4-window7-224',
'private': False,
'pipeline_tag': 'image-classification',
'sha': '896e18f760e16594e63d8bbe01ada6142bb0ef8e',
'lastModified': '2022-01-28T13:12:55.000Z',
'tags': ['pytorch', 'swin', 'image-classification', 'dataset:imagenet-1k', 'arxiv:2103.14030', 'transformers', 'license:apache-2.0', 'vision'],
'siblings': [{'rfilename': '.gitattributes'}, {'rfilename': 'README.md'}, {'rfilename': 'config.json'}, {'rfilename': 'preprocessor_config.json'}, {'rfilename': 'pytorch_model.bin'}],
'downloads': 1165,
'library_name': 'transformers',
'widgetData': [{'src': 'https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg', 'example_title': 'Tiger'}, {'src': 'https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg', 'example_title': 'Teapot'}, {'src': 'https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg', 'example_title': 'Palace'}],
'likes': 0,
'model-index': None,
'config': {'architectures': ['SwinForImageClassification'], 'model_type': 'swin'},
'cardData': {'license': 'apache-2.0', 'tags': ['vision', 'image-classification'], 'datasets': ['imagenet-1k'],
'widget': [{'src': 'https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg', 'example_title': 'Tiger'}, {'src': 'https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg', 'example_title': 'Teapot'}, {'src': 'https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg', 'example_title': 'Palace'}]}
} As what I guessed, it seems that such api |
@Andy1621 you can see the currently supported inference api pipelines gradio has here: https://github.com/gradio-app/gradio/blob/c9298b38021323918037a5a39914a787e8517f60/gradio/external.py#L49, video classification is currently not support through huggingface or gradio but you can try image classification, see current pipelines here for huggingface model hub https://github.com/huggingface/huggingface_hub/blob/df012f1489cb50f15e0908598d7e355f1f31b52f/js/src/lib/interfaces/Types.ts |
As there is no more activity, I am closing the issue, don't hesitate to reopen it if necessary. |
Hi, would you be interested in sharing a web demo on Huggingface Spaces for UniFormer?
It would make this model more accessible as it would allow people to try out the model directly from the browser. Some other recent machine learning model repos have set up Spaces for easy access:
github: https://github.com/salesforce/BLIP
Spaces: https://huggingface.co/spaces/akhaliq/BLIP
github: https://github.com/facebookresearch/omnivore
Spaces: https://huggingface.co/spaces/akhaliq/omnivore
Spaces is completely free, and I can help setup a Gradio Space. Here are some getting started instructions if you'd prefer to do it yourself: https://huggingface.co/blog/gradio-spaces
The text was updated successfully, but these errors were encountered: