Spaces:
Sleeping
Sleeping
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=["."]) | |