aliabd HF Staff commited on
Commit
2b49173
·
1 Parent(s): 4b0f355

Delete app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +0 -46
app.py DELETED
@@ -1,46 +0,0 @@
1
- import gradio as gr
2
-
3
- with gr.Blocks() as demo:
4
- gr.Markdown(
5
- """
6
- # Animal Generator
7
- Once you select a species, the detail panel should be visible.
8
- """
9
- )
10
-
11
- species = gr.Radio(label="Animal Class", choices=["Mammal", "Fish", "Bird"])
12
- animal = gr.Dropdown(label="Animal", choices=[])
13
-
14
- with gr.Column(visible=False) as details_col:
15
- weight = gr.Slider(0, 20)
16
- details = gr.Textbox(label="Extra Details")
17
- generate_btn = gr.Button("Generate")
18
- output = gr.Textbox(label="Output")
19
-
20
- species_map = {
21
- "Mammal": ["Elephant", "Giraffe", "Hamster"],
22
- "Fish": ["Shark", "Salmon", "Tuna"],
23
- "Bird": ["Chicken", "Eagle", "Hawk"],
24
- }
25
-
26
- def filter_species(species):
27
- return gr.Dropdown.update(
28
- choices=species_map[species], value=species_map[species][1]
29
- ), gr.update(visible=True)
30
-
31
- species.change(filter_species, species, [animal, details_col])
32
-
33
- def filter_weight(animal):
34
- if animal in ("Elephant", "Shark", "Giraffe"):
35
- return gr.update(maximum=100)
36
- else:
37
- return gr.update(maximum=20)
38
-
39
- animal.change(filter_weight, animal, weight)
40
- weight.change(lambda w: gr.update(lines=int(w / 10) + 1), weight, details)
41
-
42
- generate_btn.click(lambda x: x, details, output)
43
-
44
-
45
- if __name__ == "__main__":
46
- demo.launch()