File size: 550 Bytes
5b9b9ba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9dde8fb
dedcac8
5b9b9ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import requests
import gradio as gr
from PIL import Image

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
    
iface = gr.Interface(fn=t2i, inputs="text", outputs=[gr.Image(label="Generated Image")]).launch()
iface.launch(share=True)