Upload app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ README = """
|
|
13 |
"""
|
14 |
|
15 |
|
16 |
-
|
17 |
learning_rate = 5e-5
|
18 |
batch_size_train = 64
|
19 |
step = 1900
|
@@ -41,9 +41,9 @@ def tokenized_data(tokenizer, inputs):
|
|
41 |
|
42 |
|
43 |
def greet(text):
|
44 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
45 |
model = AutoModelForSequenceClassification.from_pretrained(
|
46 |
-
|
47 |
state_dict=state_dict
|
48 |
)
|
49 |
inputs = tokenized_data(tokenizer, text)
|
@@ -72,4 +72,4 @@ demo2 = gr.Interface(fn=greet, inputs="text", outputs="text",
|
|
72 |
description=description, examples=examples)
|
73 |
|
74 |
if __name__ == "__main__":
|
75 |
-
|
|
|
13 |
"""
|
14 |
|
15 |
|
16 |
+
model_name = "roberta-base"
|
17 |
learning_rate = 5e-5
|
18 |
batch_size_train = 64
|
19 |
step = 1900
|
|
|
41 |
|
42 |
|
43 |
def greet(text):
|
44 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
45 |
model = AutoModelForSequenceClassification.from_pretrained(
|
46 |
+
model_name, num_labels=2, id2label=id2label, label2id=label2id,
|
47 |
state_dict=state_dict
|
48 |
)
|
49 |
inputs = tokenized_data(tokenizer, text)
|
|
|
72 |
description=description, examples=examples)
|
73 |
|
74 |
if __name__ == "__main__":
|
75 |
+
demo2.launch()
|