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

On google colab, blob the files instead of base64coding them. #19

Open
Kreijstal opened this issue Jun 18, 2020 · 4 comments
Open

On google colab, blob the files instead of base64coding them. #19

Kreijstal opened this issue Jun 18, 2020 · 4 comments

Comments

@Kreijstal
Copy link

Kreijstal commented Jun 18, 2020

The problem is that base64coding videos will make the webpage slower and consume way more memory, but there is a better way, blobing the files.
Here is a google colab showing it off https://colab.research.google.com/drive/1FF6AHXu0L6nQw-LF8LymRotfcKfBI5Vh?usp=sharing
if you see the url of the video, you will see that it is a blob.
https://stackoverflow.com/questions/61982233/how-to-get-url-from-google-collab-file-inside-the-workspace/61984094#61984094
A SE question explaining the issue too.

Alternatively, allow a callback function for the url of the file once is completed, the callback will contain the custom code.

@krassowski
Copy link
Owner

Sounds ok. I would welcome and review a pull request implementing this as an another option if you wish to make one.

@Kreijstal
Copy link
Author

Right now I'm very busy :( but, sure if I get the time, I'll be able to work on it (I'm a still nooby in python) but no promises.

@Scoder12
Copy link
Contributor

How does this work on colab? The issue of not being able to connect to the container using localhost is the entire reason the base64 method is used. When I run your demo on colab, all I get is the following:
image

@Kreijstal
Copy link
Author

Kreijstal commented Jul 26, 2020

@Scoder12 good question, I think it works by creating a webworker, and the webworker send the requests automatically, that "localhost" you're seeing, is not actually connecting to your localhost, it should be intercepted by the browser and know it's a connection between the main thread, and the webworker.
(this is how from google.colab import files does this, so I just read the code to figure it out)
image
It worked again on my system, however.

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

No branches or pull requests

3 participants