apehex commited on
Commit
8c053ad
·
1 Parent(s): 2a33240

Match the API of gradio 6

Browse files
Files changed (2) hide show
  1. app.py +7 -9
  2. requirements.txt +1 -1
app.py CHANGED
@@ -1,5 +1,3 @@
1
- import functools
2
-
3
  import gradio
4
 
5
  import gpm.pipeline
@@ -32,7 +30,7 @@ def create_intro_block(intro: str) -> dict:
32
  # MASTER #######################################################################
33
 
34
  def create_master_block() -> dict:
35
- __key = gradio.Textbox(label='Key', type='text', value='', placeholder='Your master key.', lines=1, max_lines=1, scale=1, show_copy_button=True, interactive=True)
36
  return {
37
  'key_block': __key,}
38
 
@@ -57,8 +55,8 @@ def create_sampling_block() -> dict:
57
  # INPUTS #######################################################################
58
 
59
  def create_inputs_block() -> dict:
60
- __target = gradio.Textbox(label='Target', type='text', value='', placeholder='The login target (URL, IP, name, etc), like "Hugging Face" or "https://github.com".', lines=1, max_lines=1, scale=1, show_copy_button=True, interactive=True)
61
- __identifier = gradio.Textbox(label='Identifier', type='text', value='', placeholder='The login ID (username, email, etc), like "John Doe" or "john.doe@example.com".', lines=1, max_lines=1, scale=1, show_copy_button=True, interactive=True)
62
  return {
63
  'target_block': __target,
64
  'identifier_block': __identifier,}
@@ -66,7 +64,7 @@ def create_inputs_block() -> dict:
66
  # OUTPUTS ######################################################################
67
 
68
  def create_outputs_block() -> dict:
69
- __password = gradio.Textbox(label='Password', type='text', value='', placeholder='The generated password.', lines=1, max_lines=1, scale=1, show_copy_button=True, interactive=False)
70
  return {
71
  'password_block': __password,}
72
 
@@ -135,9 +133,9 @@ def generate_password(
135
 
136
  # APP ##########################################################################
137
 
138
- def create_app(title: str=TITLE, intro: str=INTRO, style: str=STYLE) -> gradio.Blocks:
139
  __fields = {}
140
- with gradio.Blocks(theme=gradio.themes.Soft(), title=title, css=style) as __app:
141
  # __tokenizer = psaiops.score.similarity.lib.get_tokenizer(name=model, device='cpu')
142
  # create the UI
143
  __fields.update(create_layout(intro=intro))
@@ -157,4 +155,4 @@ def create_app(title: str=TITLE, intro: str=INTRO, style: str=STYLE) -> gradio.B
157
 
158
  if __name__ == '__main__':
159
  __app = create_app()
160
- __app.launch()
 
 
 
1
  import gradio
2
 
3
  import gpm.pipeline
 
30
  # MASTER #######################################################################
31
 
32
  def create_master_block() -> dict:
33
+ __key = gradio.Textbox(label='Key', type='text', value='', placeholder='Your master key.', lines=1, max_lines=1, scale=1, interactive=True)
34
  return {
35
  'key_block': __key,}
36
 
 
55
  # INPUTS #######################################################################
56
 
57
  def create_inputs_block() -> dict:
58
+ __target = gradio.Textbox(label='Target', type='text', value='', placeholder='The login target (URL, IP, name, etc), like "Hugging Face" or "https://github.com".', lines=1, max_lines=1, scale=1, interactive=True)
59
+ __identifier = gradio.Textbox(label='Identifier', type='text', value='', placeholder='The login ID (username, email, etc), like "John Doe" or "john.doe@example.com".', lines=1, max_lines=1, scale=1, interactive=True)
60
  return {
61
  'target_block': __target,
62
  'identifier_block': __identifier,}
 
64
  # OUTPUTS ######################################################################
65
 
66
  def create_outputs_block() -> dict:
67
+ __password = gradio.Textbox(label='Password', type='text', value='', placeholder='The generated password.', lines=1, max_lines=1, scale=1, interactive=False)
68
  return {
69
  'password_block': __password,}
70
 
 
133
 
134
  # APP ##########################################################################
135
 
136
+ def create_app(title: str=TITLE, intro: str=INTRO) -> gradio.Blocks:
137
  __fields = {}
138
+ with gradio.Blocks(title=title) as __app:
139
  # __tokenizer = psaiops.score.similarity.lib.get_tokenizer(name=model, device='cpu')
140
  # create the UI
141
  __fields.update(create_layout(intro=intro))
 
155
 
156
  if __name__ == '__main__':
157
  __app = create_app()
158
+ __app.launch(theme=gradio.themes.Soft(), css=STYLE, share=True, debug=True)
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
  gpmanager>=0.4
2
- gradio>=5.0
 
1
  gpmanager>=0.4
2
+ gradio>=6.0