import requests import gradio as gr from PIL import Image import base64 def t2i(text): prompt_url = f"https://aadarsh-text-to-image-mymvubi2mq-el.a.run.app/t2i/{text}" img_url = requests.get(prompt_url).json()["url"] response = requests.get(img_url) if response.status_code: fp = open('image.png', 'wb') fp.write(response.content) fp.close() image = Image.open('image.png') return image # Read the image file and encode it as base64 with open("./1001epochs.png", "rb") as f: image_data = f.read() image_base64 = base64.b64encode(image_data).decode("utf-8") allow_flagging = "never" title = f"""

Text to Image Generator

""" description = f"""

Turn words into captivating visuals effortlessly within minutes.

Disclaimer: The purpose of this application is solely for demonstration. 1001epochs does not claim ownership for the results Contact: contact@1001epochs.co.uk for full solution.

""" iface = gr.Interface(fn=t2i, inputs="text", outputs=[gr.Image(label="Generated Image")], title=title, description=description).launch() iface.launch(share=True)