Falah commited on
Commit
24e7bc4
1 Parent(s): 071d0df

Add application file

Browse files
Files changed (2) hide show
  1. app.py +1 -14
  2. index.html +7 -18
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import random
2
  import yaml
3
  import gradio as gr
4
- from clipboard import copy
5
 
6
  def generate_text():
7
  input_data = get_options('female2.yaml')
@@ -16,9 +15,6 @@ def get_options(file_path):
16
  options = yaml.load(file, Loader=yaml.FullLoader)
17
  return options
18
 
19
- def copy_output_text(output):
20
- copy(output)
21
-
22
  iface = gr.Interface(
23
  fn=generate_text,
24
  inputs=None,
@@ -36,13 +32,4 @@ iface = gr.Interface(
36
  image="https://iraqprogrammer.files.wordpress.com/2023/03/00045-3227812873.png?w=1400&h="
37
  )
38
 
39
- copy_button = gr.Interface(
40
- fn=copy_output_text,
41
- inputs=gr.inputs.Textbox(label="Copy Output Text"),
42
- outputs=None,
43
- title="Copy Output Text",
44
- allow_flagging=False,
45
- theme="compact"
46
- )
47
-
48
- iface.launch(copy_button=copy_button)
 
1
  import random
2
  import yaml
3
  import gradio as gr
 
4
 
5
  def generate_text():
6
  input_data = get_options('female2.yaml')
 
15
  options = yaml.load(file, Loader=yaml.FullLoader)
16
  return options
17
 
 
 
 
18
  iface = gr.Interface(
19
  fn=generate_text,
20
  inputs=None,
 
32
  image="https://iraqprogrammer.files.wordpress.com/2023/03/00045-3227812873.png?w=1400&h="
33
  )
34
 
35
+ iface.launch()
 
 
 
 
 
 
 
 
 
index.html CHANGED
@@ -1,4 +1,4 @@
1
- <!doctype html>
2
  <html>
3
  <head>
4
  <title>Random Command Generator</title>
@@ -14,9 +14,12 @@
14
  </head>
15
  <body>
16
  <div class="container mt-5">
17
- <h1 class="text-center mb-4">Generated A beautiful Female AI Generator Prompts</h1>
18
- <div id="gradio"></div>
19
- <div id="copy-button"></div>
 
 
 
20
  </div>
21
  <script src="https://cdn.jsdelivr.net/npm/@gradio/[email protected]/dist/gradio.min.js"></script>
22
  <script>
@@ -28,20 +31,6 @@
28
  });
29
  });
30
  iface.render(document.getElementById('gradio'));
31
-
32
- const copyButton = gradio.Interface('http://localhost:5000', {
33
- inputs: gradio.inputs.Textbox({label: 'Copy Output Text', default: ''}),
34
- outputs: null,
35
- title: 'Copy Output Text',
36
- theme: 'compact'
37
- });
38
- copyButton.ready(() => {
39
- const button = copyButton.addButton({label: 'Copy', backgroundColor: '#28a745'});
40
- button.on('click', () => {
41
- copyButton.run(iface.outputs[0].data);
42
- });
43
- });
44
- copyButton.render(document.getElementById('copy-button'));
45
  </script>
46
  </body>
47
  </html>
 
1
+ <!DOCTYPE html>
2
  <html>
3
  <head>
4
  <title>Random Command Generator</title>
 
14
  </head>
15
  <body>
16
  <div class="container mt-5">
17
+ <div class="row justify-content-center align-items-center">
18
+ <div class="col-12 col-md-8 col-lg-6">
19
+ <img src="{{image}}" class="img-fluid mb-3">
20
+ <div id="gradio"></div>
21
+ </div>
22
+ </div>
23
  </div>
24
  <script src="https://cdn.jsdelivr.net/npm/@gradio/[email protected]/dist/gradio.min.js"></script>
25
  <script>
 
31
  });
32
  });
33
  iface.render(document.getElementById('gradio'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </script>
35
  </body>
36
  </html>