Skip to content
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

Fetch from tensorflow js fails #1

Open
hazel-sudz opened this issue Nov 25, 2019 · 9 comments
Open

Fetch from tensorflow js fails #1

hazel-sudz opened this issue Nov 25, 2019 · 9 comments

Comments

@hazel-sudz
Copy link

After selecting an image the fetch request from tfjs fails

Network request failed
- node_modules\@tensorflow\tfjs-react-native\dist\platform_react_native.js:80:49 in onerror
- node_modules\event-target-shim\lib\event-target.js:172:43 in dispatchEvent
- ... 8 more stack frames from framework internals

@hazel-sudz
Copy link
Author

As correctly noted from the article comments this is caused by the fetch request from tfjs which only supports network fetch requests and not local requests

const response = await fetch(imageAssetPath.uri, {}, { isBinary: true }) will fail
const response = await fetch('https://testimage.jpg', {}, { isBinary: true }) will succeed

I will look into what can be done to fix this

@amandeepmittal
Copy link
Owner

amandeepmittal commented Nov 27, 2019

Hey @daniel-sudz this is a great. If you are able to fix this, let me know, and with your permission, I'd add the you use case as well as your solution in the post itself. I haven't played much with tfjs tbh, and am just exploring the use cases just like you. :)

I'll let the issue open, until you decide to close it.

@Hasherz96
Copy link

Hi, is there an update on this ? I ran into the same error

@amandeepmittal
Copy link
Owner

amandeepmittal commented Feb 24, 2020

@Hasherz96 I think TFJS now supports local requests in React Native.

I will be updating the article/repo soon.

@TiagoF99
Copy link

any updates on this?

@zalkier
Copy link

zalkier commented May 3, 2020

@amandeepmittal have you been able to sucessfully request local files through the fetch function with the latest version of TFJS?

@ungurnicoleta
Copy link

Does anyone have any idea why it's working on an iOS simulator, but it crashes on an Android mobile device (not emulator)?

@sarthakpranesh
Copy link

Hey @amandeepmittal, I have made some changes and opened a pull request that fixes the problem on android but I was not able to test it on ios (not having an ios device) maybe you can test it on ios and let me know if there is anything that needs to be fixed 😄

@amandeepmittal
Copy link
Owner

Hey @sarthakpranesh thanks for the PR. Let me test on iOS and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants