Ifan 767
Ifan 767

Reputation: 512

How to share your output image from google colab to google drive and downloading?

i have tried different answers. but no success.link

plt.figure(figsize=(20,10))
fig = plt.gcf()
output_image = 
predict_on_crops(saved_model,'/content/drive/MyDrive/crack_img_f/de65bfc4563c4813bb25bb65eb6cfe76.jpg', 128, 128,)
plt.imshow(cv2.cvtColor(output_image, cv2.COLOR_BGR2RGB))
plt.show()

I am downloading the plt it is showing blank image.

from google.colab import files
plt.savefig("abc.png")
files.download("abc.png")

Upvotes: 2

Views: 569

Answers (1)

The 5th column mouse
The 5th column mouse

Reputation: 780

!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
uploaded = drive.CreateFile({'title': 'abc.png'})
uploaded.SetContentFile('abc.png')
uploaded.Upload()
print('Uploaded file with ID {}'.format(uploaded.get('id')))

Upvotes: 1

Related Questions