Instructions to use Nekshay/Finetuned-MobilVIT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nekshay/Finetuned-MobilVIT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="Nekshay/Finetuned-MobilVIT") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("Nekshay/Finetuned-MobilVIT") model = AutoModelForImageClassification.from_pretrained("Nekshay/Finetuned-MobilVIT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| import React, { useRef } from 'react'; | |
| import { View, TouchableOpacity, Text } from 'react-native'; | |
| import { RNCamera } from 'react-native-camera'; | |
| import RNFS from 'react-native-fs'; | |
| const CameraScreen = () => { | |
| const cameraRef = useRef(null); | |
| const takePicture = async () => { | |
| if (cameraRef.current) { | |
| const options = { quality: 0.5, base64: true }; | |
| const data = await cameraRef.current.takePictureAsync(options); | |
| // Save the image to the gallery | |
| saveToGallery(data.uri); | |
| } | |
| }; | |
| const saveToGallery = async (imageUri) => { | |
| try { | |
| const destinationPath = RNFS.CachesDirectoryPath + '/myImage.jpg'; | |
| // Copy the image file to the gallery | |
| await RNFS.copyFile(imageUri, destinationPath); | |
| // Notify the gallery about the new file | |
| RNFS.scanFile(destinationPath); | |
| } catch (error) { | |
| console.error('Error saving image to gallery:', error); | |
| } | |
| }; | |
| return ( | |
| <View style={{ flex: 1 }}> | |
| <RNCamera | |
| ref={cameraRef} | |
| style={{ flex: 1 }} | |
| type={RNCamera.Constants.Type.back} | |
| captureAudio={false} | |
| /> | |
| <View style={{ flex: 0, flexDirection: 'row', justifyContent: 'center' }}> | |
| <TouchableOpacity onPress={takePicture} style={{ flex: 0, backgroundColor: '#fff', borderRadius: 5, padding: 15, paddingHorizontal: 20, alignSelf: 'center', margin: 20 }}> | |
| <Text style={{ fontSize: 14 }}>Take Picture</Text> | |
| </TouchableOpacity> | |
| </View> | |
| </View> | |
| ); | |
| }; | |
| export default CameraScreen; | |