flutter_pytorch 1.0.1 copy "flutter_pytorch: ^1.0.1" to clipboard
flutter_pytorch: ^1.0.1 copied to clipboard

A flutter plugin for run object detection and image classifications from pytorch models like yolov5.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_pytorch_example/RunModelByCameraDemo.dart';
import 'package:flutter_pytorch_example/RunModelByImageDemo.dart';

void main() => runApp(ChooseDemo());

class ChooseDemo extends StatefulWidget {
  const ChooseDemo({Key? key}) : super(key: key);

  @override
  State<ChooseDemo> createState() => _ChooseDemoState();
}

class _ChooseDemoState extends State<ChooseDemo> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Pytorch Mobile Example'),
        ),
        body: Builder(
          builder: (context) {
            return Center(
              child: Column(
                children: [
                  TextButton(
                    onPressed: () => {
                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) => RunModelByCameraDemo()),
                      )
                    },
                    style: TextButton.styleFrom(
                      backgroundColor: Colors.blue,
                    ),
                    child: Text(
                      "Run Model with Camera",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                  TextButton(
                    onPressed: () => {
                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) => RunModelByImageDemo()),
                      )
                    },
                    style: TextButton.styleFrom(
                      backgroundColor: Colors.blue,
                    ),
                    child: Text(
                      "Run Model with Image",
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  )
                ],
              ),
            );
          }
        ),
      ),
    );
  }
}
9
likes
110
pub points
84%
popularity

Publisher

unverified uploader

A flutter plugin for run object detection and image classifications from pytorch models like yolov5.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (LICENSE)

Dependencies

flutter, path, path_provider, pigeon, plugin_platform_interface

More

Packages that depend on flutter_pytorch