akhaliq HF staff commited on
Commit
ebe1056
·
verified ·
1 Parent(s): 96b3b5d

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +42 -0
index.html ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js"></script>
4
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.css" />
5
+ <style>
6
+ body {
7
+ font-family: Arial, sans-serif;
8
+ background-color: #f7f1e3;
9
+ }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <gradio-lite>
14
+ import gradio as gr
15
+ import random
16
+
17
+ subjects = ['You', 'Your family', 'Your friends', 'A stranger', 'An opportunity']
18
+ verbs = ['will find', 'may encounter', 'should seek', 'will discover', 'might stumble upon']
19
+ objects = ['happiness', 'success', 'a challenge', 'love', 'wisdom']
20
+ timeframes = ['soon', 'in the near future', 'when you least expect it', 'after overcoming an obstacle', 'as a result of your hard work']
21
+
22
+ def generate_fortune(name):
23
+ fortune = f"{random.choice(subjects)} {random.choice(verbs)} {random.choice(objects)} {random.choice(timeframes)}."
24
+ if name:
25
+ return f"{name}, {fortune.lower()}"
26
+ return fortune
27
+
28
+ def fortune_cookie(name):
29
+ return generate_fortune(name)
30
+
31
+ iface = gr.Interface(
32
+ fn=fortune_cookie,
33
+ inputs=gr.Textbox(label="Enter your name (optional)"),
34
+ outputs=gr.Textbox(label="Your Fortune"),
35
+ title="Fortune Cookie Generator",
36
+ description="Get your personalized fortune!",
37
+ )
38
+
39
+ iface.launch()
40
+ </gradio-lite>
41
+ </body>
42
+ </html>