File size: 1,085 Bytes
756e2bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr

def main(image, backbone, style):
    isize = image.size
    s = f"The output image ({str(image.size)}) is processed by {backbone} based on input image ({str(isize)}) . <br> Please <b>rate</b> the generated image through the <b>Flag</b> button below!"
    return image, s


gr.Interface(
    title = "Stylize", 
    description = "Image generated based on Fast Style Transfer",
    fn = main, 
    inputs = [
        gr.inputs.Image(), 
        gr.inputs.Radio(["VGG19", "Robust ResNet50", "Standard ResNet50"], label="Backbone"),
        gr.inputs.Dropdown(["The Scream", "Rain Princess"], type="value", default="Rain Princess", label="style")
    ], 
    outputs = [gr.outputs.Image(label="Stylized"), gr.outputs.HTML(label="Comment")],
    # examples = [
    #     []
    # ],
    # live = True,    # the interface will recalculate as soon as the user input changes.
    flagging_options = ["Excellect", "Moderate", "Bad"],
    flagging_dir = "flagged",
    allow_screenshot = False,
).launch()
# iface.launch(enable_queue=True, cache_examples=True, debug=True)