# Step 2: Import libraries import gradio as gr from wordcloud import WordCloud import matplotlib.pyplot as plt # Step 3: Define the word cloud generator function def generate_word_cloud(text): wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text) plt.figure(figsize=(10, 5)) plt.imshow(wordcloud, interpolation='bilinear') plt.axis('off') plt.savefig("wordcloud.png") return "wordcloud.png" # Step 4: Set up the Gradio interface iface = gr.Interface( fn=generate_word_cloud, inputs=gr.components.Textbox(lines=10, placeholder="Enter text here..."), outputs="image", title="Word Cloud Generator", description="Generate a word cloud from the input text" ) # Step 5: Launch the interface in Colab iface.launch(share=True)