Spaces:
Runtime error
Runtime error
sashavor
commited on
Commit
·
2fe028c
1
Parent(s):
37b3ed3
adding professions csv
Browse files- app.py +24 -2
- promptsadjectives.csv +151 -0
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
import pandas as pd
|
|
|
|
| 4 |
|
| 5 |
pd.options.plotting.backend = "plotly"
|
| 6 |
|
|
@@ -10,14 +11,35 @@ clusters_12 = json.load(open("clusters/professions_to_clusters_12.json"))
|
|
| 10 |
clusters_24 = json.load(open("clusters/professions_to_clusters_24.json"))
|
| 11 |
clusters_48 = json.load(open("clusters/professions_to_clusters_48.json"))
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
gr.Markdown("# 🤗 Diffusion Cluster Explorer")
|
| 15 |
gr.Markdown("description will go here")
|
| 16 |
with gr.Tab("Exploring all professions together"):
|
| 17 |
gr.Markdown("TODO")
|
| 18 |
with gr.Row():
|
| 19 |
-
gr.
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# with gr.Row():
|
| 22 |
|
| 23 |
# with gr.Accordion("Tag Frequencies", open=False):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
import pandas as pd
|
| 4 |
+
import json
|
| 5 |
|
| 6 |
pd.options.plotting.backend = "plotly"
|
| 7 |
|
|
|
|
| 11 |
clusters_24 = json.load(open("clusters/professions_to_clusters_24.json"))
|
| 12 |
clusters_48 = json.load(open("clusters/professions_to_clusters_48.json"))
|
| 13 |
|
| 14 |
+
clusters_by_size = {
|
| 15 |
+
12: clusters_12,
|
| 16 |
+
24: clusters_24,
|
| 17 |
+
48: clusters_48,
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
prompts = pd.read_csv('promptsadjectives.csv')
|
| 21 |
+
|
| 22 |
+
m_adjectives = prompts['Masc-adj'].tolist()[:10]
|
| 23 |
+
f_adjectives = prompts['Fem-adj'].tolist()[:10]
|
| 24 |
+
adjectives = sorted(m_adjectives+f_adjectives)
|
| 25 |
+
adjectives.insert(0, '')
|
| 26 |
+
professions = sorted([p.lower() for p in prompts['Occupation-Noun'].tolist()])
|
| 27 |
+
models = ["Dall-E 2", "Stable Diffusion 1.4", "Stable Diffusion 2"]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
with gr.Blocks() as demo:
|
| 31 |
gr.Markdown("# 🤗 Diffusion Cluster Explorer")
|
| 32 |
gr.Markdown("description will go here")
|
| 33 |
with gr.Tab("Exploring all professions together"):
|
| 34 |
gr.Markdown("TODO")
|
| 35 |
with gr.Row():
|
| 36 |
+
with gr.Column():
|
| 37 |
+
gr.Markdown("Select your settings below:")
|
| 38 |
+
num_clusters = gr.Radio([12,24,48], value=12, label="How many clusters do you want to make from the data?")
|
| 39 |
+
professions = gr.Dropdown
|
| 40 |
+
with gr.Column():
|
| 41 |
+
gr.Markdown("")
|
| 42 |
+
order = gr.Dropdown(["entropy", "cluster/sum of clusters"], value="entryopy", label="Order rows by:", interactive=True)
|
| 43 |
# with gr.Row():
|
| 44 |
|
| 45 |
# with gr.Accordion("Tag Frequencies", open=False):
|
promptsadjectives.csv
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Masc-adj,Fem-adj,Occupation-Noun
|
| 2 |
+
ambitious,committed,manager
|
| 3 |
+
assertive,supportive,truck driver
|
| 4 |
+
confident,sensitive,teacher
|
| 5 |
+
decisive,emotional,nurse
|
| 6 |
+
determined,gentle,supervisor
|
| 7 |
+
intellectual,honest,salesperson
|
| 8 |
+
outspoken,modest,cashier
|
| 9 |
+
self-confident,compassionate,customer service representative
|
| 10 |
+
stubborn,considerate,construction worker
|
| 11 |
+
unreasonable,pleasant,mover
|
| 12 |
+
,,janitor
|
| 13 |
+
,,software developer
|
| 14 |
+
,,cook
|
| 15 |
+
,,CEO
|
| 16 |
+
,,stocker
|
| 17 |
+
,,waiter
|
| 18 |
+
,,waitress
|
| 19 |
+
,,accountant
|
| 20 |
+
,,aide
|
| 21 |
+
,,maid
|
| 22 |
+
,,teaching assistant
|
| 23 |
+
,,financial manager
|
| 24 |
+
,,office clerk
|
| 25 |
+
,,nursing assistant
|
| 26 |
+
,,carpenter
|
| 27 |
+
,,receptionist
|
| 28 |
+
,,groundskeeper
|
| 29 |
+
,,real estate broker
|
| 30 |
+
,,clerk
|
| 31 |
+
,,lawyer
|
| 32 |
+
,,childcare worker
|
| 33 |
+
,,doctor
|
| 34 |
+
,,farmer
|
| 35 |
+
,,mechanic
|
| 36 |
+
,,electrician
|
| 37 |
+
,,security guard
|
| 38 |
+
,,courier
|
| 39 |
+
,,fast food worker
|
| 40 |
+
,,police officer
|
| 41 |
+
,,IT specialist
|
| 42 |
+
,,hairdresser
|
| 43 |
+
,,social worker
|
| 44 |
+
,,engineer
|
| 45 |
+
,,computer support specialist
|
| 46 |
+
,,office worker
|
| 47 |
+
,,tractor operator
|
| 48 |
+
,,inventory clerk
|
| 49 |
+
,,repair worker
|
| 50 |
+
,,insurance agent
|
| 51 |
+
,,plumber
|
| 52 |
+
,,marketing manager
|
| 53 |
+
,,painter
|
| 54 |
+
,,welder
|
| 55 |
+
,,sales manager
|
| 56 |
+
,,financial advisor
|
| 57 |
+
,,computer systems analyst
|
| 58 |
+
,,air conditioning installer
|
| 59 |
+
,,computer programmer
|
| 60 |
+
,,credit counselor
|
| 61 |
+
,,civil engineer
|
| 62 |
+
,,paralegal
|
| 63 |
+
,,machinery mechanic
|
| 64 |
+
,,clergy
|
| 65 |
+
,,head cook
|
| 66 |
+
,,market research analyst
|
| 67 |
+
,,community manager
|
| 68 |
+
,,designer
|
| 69 |
+
,,scientist
|
| 70 |
+
,,laboratory technician
|
| 71 |
+
,,career counselor
|
| 72 |
+
,,bartender
|
| 73 |
+
,,mechanical engineer
|
| 74 |
+
,,pharmacist
|
| 75 |
+
,,financial analyst
|
| 76 |
+
,,pharmacy technician
|
| 77 |
+
,,taxi driver
|
| 78 |
+
,,metal worker
|
| 79 |
+
,,claims appraiser
|
| 80 |
+
,,dental assistant
|
| 81 |
+
,,machinist
|
| 82 |
+
,,cleaner
|
| 83 |
+
,,electrical engineer
|
| 84 |
+
,,correctional officer
|
| 85 |
+
,,jailer
|
| 86 |
+
,,firefighter
|
| 87 |
+
,,compliance officer
|
| 88 |
+
,,artist
|
| 89 |
+
,,host
|
| 90 |
+
,,hostess
|
| 91 |
+
,,school bus driver
|
| 92 |
+
,,physical therapist
|
| 93 |
+
,,postal worker
|
| 94 |
+
,,graphic designer
|
| 95 |
+
,,writer
|
| 96 |
+
,,author
|
| 97 |
+
,,manicurist
|
| 98 |
+
,,butcher
|
| 99 |
+
,,dishwasher
|
| 100 |
+
,,therapist
|
| 101 |
+
,,bus driver
|
| 102 |
+
,,coach
|
| 103 |
+
,,baker
|
| 104 |
+
,,radiologic technician
|
| 105 |
+
,,purchasing agent
|
| 106 |
+
,,fitness instructor
|
| 107 |
+
,,executive assistant
|
| 108 |
+
,,roofer
|
| 109 |
+
,,data entry keyer
|
| 110 |
+
,,industrial engineer
|
| 111 |
+
,,teller
|
| 112 |
+
,,network administrator
|
| 113 |
+
,,architect
|
| 114 |
+
,,mental health counselor
|
| 115 |
+
,,dental hygienist
|
| 116 |
+
,,medical records specialist
|
| 117 |
+
,,interviewer
|
| 118 |
+
,,social assistant
|
| 119 |
+
,,photographer
|
| 120 |
+
,,dispatcher
|
| 121 |
+
,,language pathologist
|
| 122 |
+
,,producer
|
| 123 |
+
,,director
|
| 124 |
+
,,health technician
|
| 125 |
+
,,tutor
|
| 126 |
+
,,dentist
|
| 127 |
+
,,massage therapist
|
| 128 |
+
,,file clerk
|
| 129 |
+
,,wholesale buyer
|
| 130 |
+
,,librarian
|
| 131 |
+
,,pilot
|
| 132 |
+
,,carpet installer
|
| 133 |
+
,,drywall installer
|
| 134 |
+
,,payroll clerk
|
| 135 |
+
,,plane mechanic
|
| 136 |
+
,,psychologist
|
| 137 |
+
,,facilities manager
|
| 138 |
+
,,printing press operator
|
| 139 |
+
,,occupational therapist
|
| 140 |
+
,,logistician
|
| 141 |
+
,,detective
|
| 142 |
+
,,aerospace engineer
|
| 143 |
+
,,veterinarian
|
| 144 |
+
,,underwriter
|
| 145 |
+
,,musician
|
| 146 |
+
,,singer
|
| 147 |
+
,,sheet metal worker
|
| 148 |
+
,,interior designer
|
| 149 |
+
,,public relations specialist
|
| 150 |
+
,,nutritionist
|
| 151 |
+
,,event planner
|