lint commited on
Commit
fa22455
·
1 Parent(s): 3adacd7

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. demo.yaml +12 -21
  2. gradify.py +1 -1
demo.yaml CHANGED
@@ -3,39 +3,30 @@ lite_metadata:
3
  liteobj_version: 0.0.7
4
  class_string: gradio.interface.Interface
5
  kwargs:
6
- title: gitio date regex
7
- description: Given two numbers, find the lowest common factor and subtract it from
8
- 100
9
  article: null
10
  thumbnail: null
11
  theme: gradio/seafoam
12
  css: null
13
  allow_flagging: never
14
  inputs:
15
- - class_string: gradio.components.Number
16
  kwargs:
17
- label: num1
18
- precision: 0
19
- - class_string: gradio.components.Number
20
- kwargs:
21
- label: num2
22
- precision: 0
23
  outputs:
24
- - class_string: gradio.components.Number
25
  kwargs:
26
  label: output
27
- precision: 0
28
  fn:
29
  class_string: gradify.gradify_closure
30
  kwargs:
31
  argmaps:
32
- - label: num1
33
- postprocessing: null
34
- - label: num2
35
- postprocessing: null
36
  func_kwargs: {}
37
- source: "def lowest_common_factor(num1, num2):\n factors1 = set()\n factors2\
38
- \ = set()\n for i in range(1, num1 + 1):\n if num1 % i == 0:\n \
39
- \ factors1.add(i)\n for i in range(1, num2 + 1):\n if\
40
- \ num2 % i == 0:\n factors2.add(i)\n common_factors = factors1.intersection(factors2)\n\
41
- \ return 100 - min(common_factors) if common_factors else 100\n"
 
3
  liteobj_version: 0.0.7
4
  class_string: gradio.interface.Interface
5
  kwargs:
6
+ title: Gradio Webapp
7
+ description: Given list of strings, create regex to extract dates
 
8
  article: null
9
  thumbnail: null
10
  theme: gradio/seafoam
11
  css: null
12
  allow_flagging: never
13
  inputs:
14
+ - class_string: gradio.components.Dataframe
15
  kwargs:
16
+ label: strings
17
+ type: array
 
 
 
 
18
  outputs:
19
+ - class_string: gradio.components.Dataframe
20
  kwargs:
21
  label: output
22
+ type: array
23
  fn:
24
  class_string: gradify.gradify_closure
25
  kwargs:
26
  argmaps:
27
+ - label: strings
28
+ postprocessing: 'lambda array: list(map(str, array[0]))'
 
 
29
  func_kwargs: {}
30
+ source: "import re\n\n\ndef extract_dates(strings):\n regex = '\\\\d{1,2}/\\\
31
+ \\d{1,2}/\\\\d{4}'\n dates = []\n for string in strings:\n matches\
32
+ \ = re.findall(regex, string)\n dates.extend(matches)\n return dates\n"
 
 
gradify.py CHANGED
@@ -31,4 +31,4 @@ def gradify_closure(source, argmaps, func_kwargs={}):
31
  import gradio as gr
32
  raise gr.Error(f"Error: {e}")
33
 
34
- return gradify_func
 
31
  import gradio as gr
32
  raise gr.Error(f"Error: {e}")
33
 
34
+ return gradify_func