mnemonic-list / app.py
Omnibus's picture
Update app.py
d9a96ba
import gradio as gr
list1=[
'aggressive',
'agreeable',
'ambitious',
'angry',
'bewildered',
'brave',
'calm',
'clumsy',
'defeated',
'delightful',
'eager',
'embarrassed',
'faithful',
'fierce',
'gentle',
'grumpy',
'happy',
'helpless',
'itchy',
'jealous',
'jolly',
'kind',
'lazy',
'lively',
'mysterious',
'nervous',
'nice',
'obedient',
'obnoxious',
'panicky',
'pitiful',
'polite',
'proud',
'repulsive',
'scary',
'silly',
'thankful',
'thoughtless',
'uptight',
'victorious',
'witty',
'wonderful',
'worried',
'zealous',
]
list2=[
'Albatross',
'Alligator',
'Antelope',
'Arctic fox',
'Armadillo',
'Baboon',
'Badger',
'Bat',
'Beagle',
'Bear',
'Beaver',
'Bison',
'Blue whale',
'Boar',
'Buffalo',
'Bull',
'Camel',
'Cat',
'Chameleon',
'Cheetah',
'Chihuahua',
'Chimpanzee',
'Chinchillas',
'Cobra',
'Cow',
'Crocodile',
'Crow',
'Deer',
'Dodo',
'Dog',
'Dolphin',
'Donkey',
'Duck',
'Eagle',
'Eel',
'Elephant',
'Elk',
'Emu',
'Fish',
'Flamingo',
'Flying squirrel',
'Fox',
'Frog',
'Giant Panda',
'Giraffe',
'Goat',
'Goose',
'Gorilla',
'Hammerhead shark',
'Hamster',
'Hare',
'Hawk',
'Hedgehog',
'Hen',
'Hermit Crab',
'Hippopotamus',
'Horse',
'Ibex',
'Iguana',
'Jackal',
'Jaguar',
'Jellyfish',
'Kangaroo',
'King Cobra',
'Koala',
'Lemur',
'Leopard',
'Lion',
'Lizard',
'Llama',
'Lynx',
'Mammoth',
'Meerkat',
'Mole',
'Monitor lizard',
'Monkey',
'Mouse',
'Mule',
'Orangutan',
'Ostrich',
'Otter',
'Owl',
'Panther',
'Peacock',
'Pigeon',
'Polar bear',
'Porcupine',
'Possum',
'Rabbit',
'Racoon',
'Rat',
'Rhinoceros',
'Sheep',
'Sloth',
'Snake',
'Swan',
'Tiger',
'Turtle',
'Vulture',
'Whale',
'Wolf',
'Wombat',
'Zebra',
]
list3=[
'ambled',
'balanced',
'barreled',
'bolted',
'bounced',
'bound',
'burst',
'careened',
'climbed',
'crawled',
'crept',
'danced',
'darted',
'dashed',
'dawdlee',
'dived',
'dodged',
'dragged',
'drove',
'fast',
'fell',
'fled',
'flew',
'flipped',
'flounced',
'galloped',
'glided',
'heaved',
'hopped',
'hurled',
'hurried',
'jogged',
'jump',
'leapt',
'loitered',
'lumbered',
'marched',
'meandered',
'melted',
'moseyed',
'moved',
'plodded',
'plummeted',
'plunged',
'pranced',
'propelled',
'punched',
'raced',
'ran',
'rolled',
'rose',
'rushed',
'sailed',
'sauntered',
'scampered',
'scrambled',
'scuttled',
'shuffled',
'skated',
'skipped',
'skittered',
'slid',
'slithered',
'slouched',
'smashed',
'snake',
'sneaked',
'soared',
'sped',
'sprinted',
'spun',
'staggered',
'stamped',
'stepped',
'stomped',
'strolled',
'strutted',
'swaggered',
'swerved',
'swooped',
'swung',
'tiptoed',
'trotted',
'trudge',
'tumbled',
'twirled',
'waddled',
'walked',
'waltzed',
'wiggled',
'zigzagged',
'zipped',
'zoomed',
]
list4=[
'aboard',
'above',
'absent',
'across',
'against',
'along',
'amid',
'among',
'around',
'at',
'atop',
'behind',
'below',
'beneath',
'beside',
'beyond',
'by',
'concerning',
'despite',
'down',
'following',
'from',
'in',
'inside',
'into',
'near',
'next to',
'over',
'onto',
'opposite',
'out of',
'outside',
'past',
'respecting',
'since',
'through',
'throughout',
'till',
'to',
'touching',
'towards',
'under',
'underneath',
'until',
'up',
'upon',
'via',
'with',
'within',
'without',
]
list5=[
'backwater',
'bank',
'bay',
'bayou',
'beach',
'bend',
'bog',
'brook',
'canyon',
'cliff',
'coast',
'cove',
'crater',
'creek',
'dell',
'delta',
'desert',
'dock',
'dunes',
'fields',
'flats',
'forest',
'fountain',
'geyser',
'glacier',
'glen',
'grassland',
'gully',
'highland',
'hills',
'hollow',
'iceberg',
'inlet',
'jetty',
'jungle',
'lagoon',
'lake',
'marina',
'marsh',
'moor',
'mountain',
'ocean',
'peak',
'pier',
'plains',
'plateau',
'pond',
'pool',
'prairie',
'rainforest',
'ridge',
'river',
'savannah',
'sea',
'shore',
'snowfields',
'spring',
'stream',
'swamp',
'switchback',
'trees',
'tundra',
'valley',
'volcano',
'wharf',
]
def count_complex():
cnt1=len(list1)
cnt2=len(list2)
cnt3=len(list3)
cnt4=len(list4)
cnt5=len(list5)
out=cnt1*cnt2*cnt3*cnt4*cnt5
return out
def fill_phrase(inp1,inp2,inp3,inp4,inp5):
if inp1 == "": inp1="-blank-"
if inp2 == "": inp2="-blank-"
if inp3 == "": inp3="-blank-"
if inp4 == "": inp4="-blank-"
if inp5 == "": inp5="-blank-"
return f"The {inp1} {inp2} {inp3} {inp4} the {inp5}."
#phrase=f"The {inp1} {inp2} {inp3} {inp4} the {inp5}."
with gr.Blocks() as app:
with gr.Group():
with gr.Row():
inp1=gr.Dropdown(value="",choices=(l for l in list1))
inp2=gr.Dropdown(value="",choices=(l for l in list2))
inp3=gr.Dropdown(value="",choices=(l for l in list3))
inp4=gr.Dropdown(value="",choices=(l for l in list4))
inp5=gr.Dropdown(value="",choices=(l for l in list5))
with gr.Row():
out_box=gr.Textbox(scale=2)
cnt_box=gr.Number(scale=1)
app.load(fill_phrase,[inp1,inp2,inp3,inp4,inp5],out_box,show_progress=False)
app.load(count_complex,None,cnt_box)
inp1.change(fill_phrase,[inp1,inp2,inp3,inp4,inp5],out_box,show_progress=False)
inp2.change(fill_phrase,[inp1,inp2,inp3,inp4,inp5],out_box,show_progress=False)
inp3.change(fill_phrase,[inp1,inp2,inp3,inp4,inp5],out_box,show_progress=False)
inp4.change(fill_phrase,[inp1,inp2,inp3,inp4,inp5],out_box,show_progress=False)
inp5.change(fill_phrase,[inp1,inp2,inp3,inp4,inp5],out_box,show_progress=False)
app.launch()