NeuralFalcon commited on
Commit
34127be
Β·
verified Β·
1 Parent(s): 3a71bf8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -11
app.py CHANGED
@@ -1,11 +1,16 @@
1
  import gradio as gr
2
 
3
- def repeat_emoji(emoji, count):
4
  try:
5
  count = int(count)
6
- if int(count) < 1:
7
  return "Please enter a number greater than 0."
8
- return emoji * int(count)
 
 
 
 
 
9
  except:
10
  return "Please enter a valid number."
11
 
@@ -13,17 +18,18 @@ app = gr.Interface(
13
  fn=repeat_emoji,
14
  inputs=[
15
  gr.Textbox(label="Emoji", placeholder="e.g., πŸ’€"),
16
- gr.Number(label="How many times?", value=10, precision=0)
 
17
  ],
18
- outputs=gr.Textbox(label="Copy Duplicated Emoji", lines=4),
19
  title="πŸŒ€ Emoji Duplicator",
20
- description="Enter any emoji and choose how many times to duplicate it!",
21
  examples=[
22
- ["πŸ’€", 5],
23
- ["πŸ˜‚", 12],
24
- ["🌈", 20],
25
- ["🐢", 8],
26
- ["πŸ’–", 15],
27
  ],
28
  )
29
 
 
1
  import gradio as gr
2
 
3
+ def repeat_emoji(emoji, count, new_line):
4
  try:
5
  count = int(count)
6
+ if count < 1:
7
  return "Please enter a number greater than 0."
8
+ if new_line:
9
+ # Repeat emoji separated by newline
10
+ return (emoji + "\n") * count
11
+ else:
12
+ # Repeat emoji continuously
13
+ return emoji * count
14
  except:
15
  return "Please enter a valid number."
16
 
 
18
  fn=repeat_emoji,
19
  inputs=[
20
  gr.Textbox(label="Emoji", placeholder="e.g., πŸ’€"),
21
+ gr.Number(label="How many times?", value=10, precision=0),
22
+ gr.Checkbox(label="New Line?", info="Put each emoji on a new line")
23
  ],
24
+ outputs=gr.Textbox(label="Copy Duplicated Emoji", lines=10),
25
  title="πŸŒ€ Emoji Duplicator",
26
+ description="Enter any emoji and choose how many times to duplicate it! Choose if you want each emoji on a new line.",
27
  examples=[
28
+ ["πŸ’€", 5, False],
29
+ ["πŸ˜‚", 12, True],
30
+ ["🌈", 20, False],
31
+ ["🐢", 8, True],
32
+ ["πŸ’–", 15, False],
33
  ],
34
  )
35