How to use the model functions within Gradio

Greetings everyone,

I have my model hosted in huggingface hub, and now i’m trying to create a demo for it using Gradio. The demo is supposed to be asking the user for the model mode, based on that it generates the output, so how can we access the model’s functions in aim to have a if-else flow while creating Gradio demo?

def model(mode, output):
if output==‘Generate Image Randomly’:
img= model.generate_randomly()
elif output==‘Generate Art Grid’:
imimga = model.generate_grid()
return img