Spaces:
Sleeping
Sleeping
Commit
·
e1bf3e5
1
Parent(s):
dac4384
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,42 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
with gr.Blocks(title="Josiah's Gradio Playground") as playground:
|
3 |
with gr.Tab("Tabs within Tabs"):
|
4 |
with gr.Tab("1. first"):
|
5 |
gr.Markdown("you're on 1")
|
6 |
with gr.Tab("2. third"):
|
7 |
gr.Markdown("you're on second")
|
|
|
|
|
8 |
|
9 |
playground.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import random
|
3 |
+
|
4 |
+
def letterize(x):
|
5 |
+
names = [
|
6 |
+
"Jake",
|
7 |
+
"John",
|
8 |
+
"Greg Heffley",
|
9 |
+
"Mark Zuckerberg",
|
10 |
+
"Ian",
|
11 |
+
"Scotland",
|
12 |
+
"Bill Gates",
|
13 |
+
"Lil Nas X",
|
14 |
+
"Micheal Kovach"
|
15 |
+
]
|
16 |
+
return f"""
|
17 |
+
Dear {random.choices(names)},
|
18 |
+
{x}
|
19 |
+
|
20 |
+
Sincerely, {random.choices(names)}
|
21 |
+
"""
|
22 |
+
|
23 |
+
def flip_text(x):
|
24 |
+
return x[::-1]
|
25 |
+
|
26 |
+
def txtRouletteHandler(x)
|
27 |
+
rn = random.randrange(1)
|
28 |
+
if (rn == 0):
|
29 |
+
return letterize(x)
|
30 |
+
if (rn == 1):
|
31 |
+
return flip_text(x)
|
32 |
+
|
33 |
with gr.Blocks(title="Josiah's Gradio Playground") as playground:
|
34 |
with gr.Tab("Tabs within Tabs"):
|
35 |
with gr.Tab("1. first"):
|
36 |
gr.Markdown("you're on 1")
|
37 |
with gr.Tab("2. third"):
|
38 |
gr.Markdown("you're on second")
|
39 |
+
with gr.Tab("Text Roulette"):
|
40 |
+
|
41 |
|
42 |
playground.launch()
|