gradio/demo/save_file_no_output/run.ipynb
Archit-Kohli 921716f618
Fixed visibility issue for all notebooks on GitHub (#5917)
* fixed visibility error in notebooks in github

* Delete fixNotebooks.py

deleted script used to fix notebooks

* Update generate_notebooks.py

fixed a small bug that prevented visibility of notebooks in GitHub
2023-10-15 18:16:57 -07:00

991 B

Gradio Demo: save_file_no_output

In [ ]:
!pip install -q gradio 
In [ ]:
import random
import string
import gradio as gr 

def save_image_random_name(image):
    random_string = ''.join(random.choices(string.ascii_letters, k=20)) + '.png'
    image.save(random_string)
    print(f"Saved image to {random_string}!")

demo = gr.Interface(
    fn=save_image_random_name, 
    inputs=gr.Image(type="pil"), 
    outputs=None,
)
if __name__ == "__main__":
    demo.launch()