File size: 1,056 Bytes
de0b504
5748447
de0b504
5748447
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import gradio as gr
import random

# Define the function that greets the user and returns a lucky number
def greet_number(name):
    greeting = "Hello " + name
    lucky_number = random.randint(1, 100)
    return greeting, lucky_number

# Custom CSS to set the background color
css = """
.gradio-container {
    background: rgb(14, 43, 99);
    display: flex;
    flex-direction: column;
    align-items: center;
}
"""

# HTML content for the logo
html_content = """
<div style="text-align: center; margin-bottom: 20px;">
    <img src='https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTwdcZ7gojHo8NrnBH7PO-PLMDUxQG9DhbX4aPywKf45A&s' alt='BAT Bangladesh Logo' style='max-width: 200px;'>
</div>
"""

with gr.Blocks(css=css) as demo:
    gr.HTML(html_content)
    gr.Interface(
        fn=greet_number,
        inputs=gr.Textbox(label="Name", placeholder="Enter Name Here"),
        outputs=[gr.Textbox(label="Greeting"), gr.Number(label="Your Lucky Number")],
        title="GreetLucky",
        theme="default",
    )

demo.launch(allowed_paths=["."])