Hi all,
I’m new to anvil. Please help me. There is a colab notebook(pifuhd) where a user can upload photo and process it and make a 3d model out of the photo.
I had make an anvil form for the photo but I’m stuck on how to move it in the Google Colab. The form is working but I don’t how to move the image in the google colab so that the image will be process. The image needs to be save in foldername/sample images in google colab.
Thanks in advance.
def file_loader_box_change(self, **event_args):
"""This method is called when a new file is loaded into this FileLoader"""
from google.colab import files
filename = list(files.upload().keys())[0]
# You can pass it to a server function for secure processing.
anvil.server.call('handle_a_file',photo)
f = app_files.photo
f.set_media(self.file_loader_box.file)
# Or you can use it in your form (insecure, so don't so anything private!)
# print(file.get_bytes())
def submit_button_click(self, **event_args):
email = self.email_box.text
photo=self.file_loader_box.file
anvil.server.call('add_photo', email, photo)
Notification("We received your submission, and sent an email to the owner of this app.", title="Thanks!").show()
self.clear_inputs()