Update index.html
Browse files- index.html +11 -10
index.html
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
import gradio as gr
|
10 |
import random
|
11 |
|
12 |
-
|
13 |
"A pleasant surprise is waiting for you.",
|
14 |
"Your hard work will pay off in the near future.",
|
15 |
"A new opportunity will present itself soon.",
|
@@ -25,18 +25,19 @@ fortunes = [
|
|
25 |
def get_fortune(name):
|
26 |
if not name.strip():
|
27 |
return "Please enter your name to receive a fortune."
|
28 |
-
fortune = random.choice(
|
29 |
return f"{name.strip()}, your fortune: {fortune}"
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
)
|
38 |
|
39 |
-
|
|
|
40 |
</gradio-lite>
|
41 |
</body>
|
42 |
</html>
|
|
|
9 |
import gradio as gr
|
10 |
import random
|
11 |
|
12 |
+
FORTUNES = [
|
13 |
"A pleasant surprise is waiting for you.",
|
14 |
"Your hard work will pay off in the near future.",
|
15 |
"A new opportunity will present itself soon.",
|
|
|
25 |
def get_fortune(name):
|
26 |
if not name.strip():
|
27 |
return "Please enter your name to receive a fortune."
|
28 |
+
fortune = random.choice(FORTUNES)
|
29 |
return f"{name.strip()}, your fortune: {fortune}"
|
30 |
|
31 |
+
with gr.Blocks() as demo:
|
32 |
+
gr.Markdown("# 🥠 Fortune Cookie Generator")
|
33 |
+
name_input = gr.Textbox(label="Your Name")
|
34 |
+
fortune_output = gr.Textbox(label="Your Fortune")
|
35 |
+
submit_button = gr.Button("Get Fortune")
|
36 |
+
|
37 |
+
submit_button.click(fn=get_fortune, inputs=name_input, outputs=fortune_output)
|
38 |
|
39 |
+
if __name__ == "__main__":
|
40 |
+
demo.launch()
|
41 |
</gradio-lite>
|
42 |
</body>
|
43 |
</html>
|