Update index.html
Browse files- index.html +31 -36
index.html
CHANGED
@@ -7,43 +7,38 @@
|
|
7 |
<body>
|
8 |
<gradio-lite>
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
typing-extensions
|
13 |
-
</gradio-requirements>
|
14 |
-
|
15 |
-
import gradio as gr
|
16 |
-
import random
|
17 |
-
|
18 |
-
FORTUNES = [
|
19 |
-
"A pleasant surprise is waiting for you.",
|
20 |
-
"Your hard work will pay off in the near future.",
|
21 |
-
"A new opportunity will present itself soon.",
|
22 |
-
"Your creativity will lead you to success.",
|
23 |
-
"An unexpected journey will bring you joy.",
|
24 |
-
"A wise decision lies ahead of you.",
|
25 |
-
"Your kindness will be rewarded tenfold.",
|
26 |
-
"A long-lost friend will reenter your life.",
|
27 |
-
"Your persistence will overcome current challenges.",
|
28 |
-
"A positive change is on the horizon."
|
29 |
-
]
|
30 |
-
|
31 |
-
def get_fortune(name):
|
32 |
-
if not name.strip():
|
33 |
-
return "Please enter your name to receive a fortune."
|
34 |
-
fortune = random.choice(FORTUNES)
|
35 |
-
return f"{name.strip()}, your fortune: {fortune}"
|
36 |
-
|
37 |
-
with gr.Blocks() as demo:
|
38 |
-
gr.Markdown("# 🥠 Fortune Cookie Generator")
|
39 |
-
name_input = gr.Textbox(label="Your Name")
|
40 |
-
fortune_output = gr.Textbox(label="Your Fortune")
|
41 |
-
submit_button = gr.Button("Get Fortune")
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
</gradio-lite>
|
48 |
</body>
|
49 |
</html>
|
|
|
7 |
<body>
|
8 |
<gradio-lite>
|
9 |
|
10 |
+
import gradio as gr
|
11 |
+
import random
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
FORTUNES = [
|
14 |
+
"A pleasant surprise is waiting for you.",
|
15 |
+
"Your hard work will pay off in the near future.",
|
16 |
+
"A new opportunity will present itself soon.",
|
17 |
+
"Your creativity will lead you to success.",
|
18 |
+
"An unexpected journey will bring you joy.",
|
19 |
+
"A wise decision lies ahead of you.",
|
20 |
+
"Your kindness will be rewarded tenfold.",
|
21 |
+
"A long-lost friend will reenter your life.",
|
22 |
+
"Your persistence will overcome current challenges.",
|
23 |
+
"A positive change is on the horizon."
|
24 |
+
]
|
25 |
+
|
26 |
+
def get_fortune(name):
|
27 |
+
if not name.strip():
|
28 |
+
return "Please enter your name to receive a fortune."
|
29 |
+
fortune = random.choice(FORTUNES)
|
30 |
+
return f"{name.strip()}, your fortune: {fortune}"
|
31 |
+
|
32 |
+
with gr.Blocks() as demo:
|
33 |
+
gr.Markdown("# 🥠 Fortune Cookie Generator")
|
34 |
+
name_input = gr.Textbox(label="Your Name")
|
35 |
+
fortune_output = gr.Textbox(label="Your Fortune")
|
36 |
+
submit_button = gr.Button("Get Fortune")
|
37 |
+
|
38 |
+
submit_button.click(fn=get_fortune, inputs=name_input, outputs=fortune_output)
|
39 |
+
|
40 |
+
if __name__ == "__main__":
|
41 |
+
demo.launch()
|
42 |
</gradio-lite>
|
43 |
</body>
|
44 |
</html>
|