Code Monkey home page Code Monkey logo

anasfik / replicate Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 7.0 1.68 MB

A community-maintained Dart client package for Replicate.com, this package let you interact with Replicate.com APIs and create predictions from the available machine learning models.

Home Page: https://replicate.com/

License: MIT License

Dart 100.00%
ai api artificial-intelligence cloud-based dart dart-package machine-learning replicate replicate-data stable-diffusion

replicate's People

Contributors

anasfik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

replicate's Issues

Error while creating prediction

Hi,
Thanks for the wonderful package! I am trying to create prediction but it always throws an error :

[Replicate] request started from/to: https://api.replicate.com/v1/predictions.
[Replicate] request from/to: https://api.replicate.com/v1/predictions end.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'Map<String, dynamic>'
#0 new Prediction.fromJson prediction.dart:75
#1 ReplicatePrediction.create. predictions.dart:62
#2 ReplicateHttpClient.post http_client.dart:54
#3 _MyHomePageState.build. main.dart:61

image

'Logs' decoding crash

Hey, nice pub, thank you.

I am using it for some tests, just wanted to let you know that I had to comment out the decoding of the 'logs' key in the Prediction model. It was crashing it

image

Conflict in Flutter Latest Version

Hi,

Thanks for the wonderful package! I am trying to install the package but throws below error

Because every version of flutter from sdk depends on meta 1.8.0 and every version of replicate depends on meta ^1.9.0, flutter from sdk is incompatible with replicate.
So, because replicate_api depends on both flutter from sdk and replicate any, version solving failed.

Stream is not working

The code snippet related to streaming isn't functioning as expected. It seems that despite using examplePredictionId, which is supposed to be the ID of the prediction generated by Replicate.instance.predictions.create, no events are being triggered.

Is it possible that streaming isn't supported? It seems that the stream codes have been commented out. I already uncomment and run the stream, however no event is never triggered.

  Stream<Prediction> stream = Replicate.instance.predictions.snapshots(
      id: examplePredictionId!,
      pollingInterval: Duration(seconds: 2),
      shouldTriggerOnlyStatusChanges: true,
      stopPollingRequestsOnPredictionTermination: true,
    );

  expect(stream, isA<Stream<Prediction>>());

  stream.listen((event) {
    print('Received event: $event');
    expect(event, isA<Prediction>());
    expect(event.id, examplePredictionId!);
    print(event.status);
  }, onError: (e) {
    print('Error in stream: $e');
    fail('should not throw an exception');
  }, onDone: () async {
    print('Stream closed');
    print('done');
    FetchedPrediction prediction = await Replicate.instance.predictions.get(
      id: examplePredictionId!,
    );
    final imageUrlList = prediction.output;
    await saveImageFromUrl(imageUrlList, 'outputs');

  });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.