lite_metadata: | |
gradio_version: 3.32.0 | |
class_string: gradio.interface.Interface | |
kwargs: | |
title: Gradio Webapp | |
description: 'Given two png images, find the L1 loss ' | |
article: null | |
thumbnail: null | |
theme: gradio/seafoam | |
css: null | |
allow_flagging: never | |
inputs: | |
class_string: liteobj.listify | |
args: | |
- class_string: gradio.components.Textbox | |
kwargs: | |
label: image1 | |
- class_string: gradio.components.Textbox | |
kwargs: | |
label: image2 | |
outputs: | |
class_string: liteobj.listify | |
args: | |
- class_string: gradio.components.Number | |
kwargs: | |
label: output | |
fn: | |
class_string: gradify.gradify_closure | |
kwargs: | |
argmaps: | |
class_string: liteobj.listify | |
args: | |
- label: image1 | |
postprocessing: null | |
- label: image2 | |
postprocessing: null | |
func_kwargs: {} | |
ldict: | |
class_string: gradify.exec_to_dict | |
kwargs: | |
source: "from PIL import Image\n\n\ndef l1_loss(image1, image2):\n img1\ | |
\ = Image.open(image1)\n img2 = Image.open(image2)\n pixels1 = img1.load()\n\ | |
\ pixels2 = img2.load()\n width, height = img1.size\n loss =\ | |
\ 0\n for x in range(width):\n for y in range(height):\n \ | |
\ for c in range(3):\n loss += abs(pixels1[x, y][c]\ | |
\ - pixels2[x, y][c])\n return loss / (width * height * 3)\n" | |