emilylearning commited on
Commit
e451fb3
1 Parent(s): 07e397d

add OLM model, rem depracted gradio 'type' arg

Browse files
Files changed (3) hide show
  1. .gitignore +1 -1
  2. README.md +7 -0
  3. app.py +5 -4
.gitignore CHANGED
@@ -1,4 +1,4 @@
1
  venv_*
2
  __pycache__*
3
  .DS_Store
4
-
 
1
  venv_*
2
  __pycache__*
3
  .DS_Store
4
+ app.py-*
README.md CHANGED
@@ -9,4 +9,11 @@ app_file: app.py
9
  pinned: false
10
  ---
11
 
 
 
 
 
 
 
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
9
  pinned: false
10
  ---
11
 
12
+ # Setup env:
13
+ ```
14
+ python3 -m venv venv_llm
15
+ source venv_llm/bin/activate
16
+ pip install -r requirements.txt
17
+ ```
18
+
19
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -17,6 +17,7 @@ MODEL_NAME_DICT = {
17
  "bert-large-uncased": "BERT-large",
18
  "roberta-base": "RoBERTa-base",
19
  "bert-base-uncased": "BERT-base",
 
20
  OWN_MODEL_NAME: "Your model's"
21
  }
22
  MODEL_NAMES = list(MODEL_NAME_DICT.keys())
@@ -50,6 +51,7 @@ GENDERED_LIST = [
50
  ]
51
 
52
 
 
53
  # %%
54
  # Fire up the models
55
  models = {m : pipeline("fill-mask", model=m) for m in MODEL_NAMES if m != OWN_MODEL_NAME}
@@ -265,12 +267,11 @@ with demo:
265
  "If there is an * by a sentence number, then at least one top prediction for that sentence was non-gendered.")
266
 
267
  with gr.Row():
268
- female_fig = gr.Plot(type="auto")
269
  with gr.Row():
270
  female_df = gr.Dataframe()
271
  with gr.Row():
272
- display_text = gr.Textbox(
273
- type="auto", label="Sample of text fed to model")
274
 
275
  uncertain_btn.click(
276
  fn=predict_gender_pronouns,
@@ -279,6 +280,6 @@ with demo:
279
  outputs=[display_text, female_df, female_fig]
280
  )
281
 
282
- demo.launch(debug=True)
283
 
284
  # %%
 
17
  "bert-large-uncased": "BERT-large",
18
  "roberta-base": "RoBERTa-base",
19
  "bert-base-uncased": "BERT-base",
20
+ "olm/olm-roberta-base-oct-2022": "OLM_RoBERTa-base",
21
  OWN_MODEL_NAME: "Your model's"
22
  }
23
  MODEL_NAMES = list(MODEL_NAME_DICT.keys())
 
51
  ]
52
 
53
 
54
+
55
  # %%
56
  # Fire up the models
57
  models = {m : pipeline("fill-mask", model=m) for m in MODEL_NAMES if m != OWN_MODEL_NAME}
 
267
  "If there is an * by a sentence number, then at least one top prediction for that sentence was non-gendered.")
268
 
269
  with gr.Row():
270
+ female_fig = gr.Plot()#type="auto")
271
  with gr.Row():
272
  female_df = gr.Dataframe()
273
  with gr.Row():
274
+ display_text = gr.Textbox(label="Sample of text fed to model")
 
275
 
276
  uncertain_btn.click(
277
  fn=predict_gender_pronouns,
 
280
  outputs=[display_text, female_df, female_fig]
281
  )
282
 
283
+ demo.launch(share=True, debug=True)
284
 
285
  # %%