TomokiFujihara commited on
Commit
f8efa7c
β€’
1 Parent(s): 1272055

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -3,10 +3,12 @@ from transformers import AutoTokenizer, AutoModelForSequenceClassification
3
  import torch
4
  import numpy as np
5
  import gradio as gr
 
 
6
 
7
  # γƒˆγƒΌγ‚―γƒŠγ‚€γ‚ΆγƒΌγ¨γƒ’γƒ‡γƒ«γ‚’γƒ­γƒΌγƒ‰γ™γ‚‹
8
  tokenizer = AutoTokenizer.from_pretrained("studio-ousia/luke-japanese-base-lite")
9
- model = AutoModelForSequenceClassification.from_pretrained("TomokiFujihara/luke-japanese-base-lite-offensiveness-estimation", trust_remote_code=True, use_auth_token='TOKEN_OFFENSIVENESS_ESTIMATION')
10
 
11
  # txtε…₯εŠ›γ‚’ε—γ‘ε–γ‚Šγ€γγ‚Œγ‚’δ½Ώη”¨γ—γ¦ζ–°γ—γ„txtγ‚’η”Ÿζˆγ™γ‚‹ι–’ζ•°
12
  def generate(text):
 
3
  import torch
4
  import numpy as np
5
  import gradio as gr
6
+ import os
7
+ SECRET_TOKEN = os.getenv("TOKEN_OFFENSIVENESS_ESTIMATION")
8
 
9
  # γƒˆγƒΌγ‚―γƒŠγ‚€γ‚ΆγƒΌγ¨γƒ’γƒ‡γƒ«γ‚’γƒ­γƒΌγƒ‰γ™γ‚‹
10
  tokenizer = AutoTokenizer.from_pretrained("studio-ousia/luke-japanese-base-lite")
11
+ model = AutoModelForSequenceClassification.from_pretrained("TomokiFujihara/luke-japanese-base-lite-offensiveness-estimation", trust_remote_code=True, use_auth_token=SECRET_TOKEN)
12
 
13
  # txtε…₯εŠ›γ‚’ε—γ‘ε–γ‚Šγ€γγ‚Œγ‚’δ½Ώη”¨γ—γ¦ζ–°γ—γ„txtγ‚’η”Ÿζˆγ™γ‚‹ι–’ζ•°
14
  def generate(text):