File size: 531 Bytes
6671e18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b42aaf
6671e18
6b42aaf
6671e18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from PIL import Image
from urllib.request import Request, urlopen

def display_image_from_url(url):
    if url == '':
        return None, ""

    req = Request(
        url=url, 
        headers={'User-Agent': 'Mozilla/5.0'}
    )
    res = urlopen(req)
    image = Image.open(res)
    image.load()

    return image, image.info['parameters'], image.info

server = gr.Interface(display_image_from_url, "text", ["image", gr.Textbox(label="Generation Parameters"), gr.Textbox(label="Metadata")])
server.launch()