lint commited on
Commit
5cd0396
·
1 Parent(s): 3f952e8

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. demo.yaml +5 -16
  2. gradify.py +4 -8
demo.yaml CHANGED
@@ -4,16 +4,13 @@ lite_metadata:
4
  class_string: gradio.interface.Interface
5
  kwargs:
6
  title: gitio app
7
- description: Conversational assistant.
8
  article: null
9
  thumbnail: null
10
- theme: ParityError/Anime
11
  css: null
12
  allow_flagging: never
13
- inputs:
14
- - class_string: gradio.components.Textbox
15
- kwargs:
16
- label: user_input
17
  outputs:
18
  - class_string: gradio.components.Textbox
19
  kwargs:
@@ -21,14 +18,6 @@ kwargs:
21
  fn:
22
  class_string: gradify.gradify_closure
23
  kwargs:
24
- argmaps:
25
- - label: user_input
26
- postprocessing: null
27
  func_kwargs: {}
28
- ldict:
29
- class_string: gradify.exec_to_dict
30
- kwargs:
31
- source: "def conversational_assistant(user_input):\n greetings = ['hi',\
32
- \ 'hello', 'hey']\n if user_input.lower() in greetings:\n return\
33
- \ 'Hello! How can I assist you today?'\n else:\n return \"I'm\
34
- \ sorry, I didn't understand your request. Please try again.\""
 
4
  class_string: gradio.interface.Interface
5
  kwargs:
6
  title: gitio app
7
+ description: make hello world app
8
  article: null
9
  thumbnail: null
10
+ theme: gradio/seafoam
11
  css: null
12
  allow_flagging: never
13
+ inputs: []
 
 
 
14
  outputs:
15
  - class_string: gradio.components.Textbox
16
  kwargs:
 
18
  fn:
19
  class_string: gradify.gradify_closure
20
  kwargs:
21
+ argmaps: []
 
 
22
  func_kwargs: {}
23
+ source: "def hello_world():\n return 'Hello, World!'\n\n\nprint(hello_world())\n"
 
 
 
 
 
 
gradify.py CHANGED
@@ -1,7 +1,10 @@
1
 
2
 
3
- def gradify_closure(ldict, argmaps, func_kwargs={}):
4
 
 
 
 
5
  from types import FunctionType
6
  for k, v in ldict.items():
7
  if isinstance(v, FunctionType):
@@ -29,10 +32,3 @@ def gradify_closure(ldict, argmaps, func_kwargs={}):
29
  raise gr.Error(f"Error: {e}")
30
 
31
  return gradify_func
32
-
33
- def exec_to_dict(source, target=None):
34
-
35
- ldict = {}
36
- exec(source, globals(), ldict)
37
-
38
- return ldict.get(target, None) if target else ldict
 
1
 
2
 
3
+ def gradify_closure(source, argmaps, func_kwargs={}):
4
 
5
+ ldict = {}
6
+ exec(source, globals(), ldict)
7
+
8
  from types import FunctionType
9
  for k, v in ldict.items():
10
  if isinstance(v, FunctionType):
 
32
  raise gr.Error(f"Error: {e}")
33
 
34
  return gradify_func