shamblett / huggingface_client

A Hugging Face server and browser based REST API client for the inference and inference endpoint API's
MIT License
8 stars 2 forks source link

just checking why the web platform is not supported? #6

Closed swframe closed 1 month ago

swframe commented 1 year ago

When I add the huggingface_client to my test app, executing "flutter run -d chrome" doesn't work. I see the huggingface_client doesn't list web as a supported platform so I'm not surprised. Could you help me understand why it is not possible to support the web platform? I thought the huggingface API is REST so access from a browser should be possible.

Thanks!

shamblett commented 1 year ago

Ill try this and get back to you.

shamblett commented 1 year ago

The error seems to be this if I run the browser tests -

Invalid argument(s): Unsupported conditional import of `dart:io` found in huggingface_client|lib/huggingface_client.dart:

import 'dart:io' if (dart.library.html) 'dart:html';

I didn't realise you couldn't conditionally import dart packages, I'll fix this.

shamblett commented 10 months ago

This seems to be more a limitation of build_runner than the package itself. The build_runner package does not support conditional inclusion of 'dart:' packages, hence running the test suite on the browser fails. There is a work around for this that I've applied to the package and re released at version 1.2.2.

As far as I can see this shouldn't have stopped the client working in the browser when deployed properly.