|
import gradio as gr |
|
import random |
|
|
|
|
|
def greet_number(name): |
|
greeting = "Hello " + name |
|
lucky_number = random.randint(1, 100) |
|
return greeting, lucky_number |
|
|
|
|
|
desc = "This Gradio app **GreetLucky** takes a *name as input* and creates " \ |
|
"a friendly greeting along with a randomly assigned ***lucky number between 1 and 100.***" |
|
|
|
article = "<h3>How to Use:</h3> " \ |
|
"<ul><li>Open the GreetLucky app.</li> " \ |
|
"<li>Enter your name in the provided input box.</li>" \ |
|
"<li>Click on the 'Submit' button. <strong>Voila!</strong>. Your personalized greeting " \ |
|
"and lucky number will appear on the screen.</li></ul>" |
|
|
|
demo = 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", |
|
description=desc, |
|
article=article, |
|
theme="gradio/seafoam" |
|
) |
|
|
|
demo.launch() |
|
|