File size: 1,384 Bytes
58093f0
 
39529ec
58093f0
 
39c9508
a54926f
 
58093f0
 
5cd0396
58093f0
 
df32adb
a54926f
df32adb
a54926f
 
 
 
 
 
58093f0
a54926f
39529ec
 
58093f0
 
 
df32adb
a54926f
 
 
 
58093f0
a54926f
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
lite_metadata:
  gradio_version: 3.32.0
  liteobj_version: 0.0.7
class_string: gradio.interface.Interface
kwargs:
  title: gitio app
  description: 'Let the user draw two figures, circle, rectangle or square and compute
    the total area '
  article: null
  thumbnail: null
  theme: gradio/seafoam
  css: null
  allow_flagging: never
  inputs:
  - class_string: gradio.components.Dataframe
    kwargs:
      label: shapes
      type: array
  - class_string: gradio.components.Dataframe
    kwargs:
      label: dimensions
      type: array
  outputs:
  - class_string: gradio.components.Number
    kwargs:
      label: output
  fn:
    class_string: gradify.gradify_closure
    kwargs:
      argmaps:
      - label: shapes
        postprocessing: 'lambda array: list(map(str, array[0]))'
      - label: dimensions
        postprocessing: 'lambda array: list(map(float, array[0]))'
      func_kwargs: {}
      source: "import math\n\n\ndef calculate_area(shapes, dimensions):\n    total_area\
        \ = 0\n    for i in range(len(shapes)):\n        if shapes[i] == 'circle':\n\
        \            total_area += math.pi * dimensions[i] ** 2\n        elif shapes[i]\
        \ == 'rectangle':\n            total_area += dimensions[i] * dimensions[i\
        \ + 1]\n        elif shapes[i] == 'square':\n            total_area += dimensions[i]\
        \ ** 2\n    return total_area"