Spaces:
Build error
Build error
danseith
commited on
Commit
·
13f7861
1
Parent(s):
2bf7c7e
Removed TempScale class for debugging
Browse files
app.py
CHANGED
@@ -1,22 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
-
from transformers import pipeline
|
4 |
|
5 |
unmasker = pipeline("fill-mask", model="anferico/bert-for-patents")
|
6 |
|
7 |
example = 'A crustless sandwich made from two slices of baked bread'
|
8 |
|
9 |
|
10 |
-
class TempScalePipe(
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
def unmask(text):
|
22 |
text = add_mask(text)
|
@@ -27,7 +28,7 @@ def unmask(text):
|
|
27 |
|
28 |
textbox = gr.Textbox(label="Type language here", lines=5)
|
29 |
import gradio as gr
|
30 |
-
from transformers import pipeline
|
31 |
|
32 |
|
33 |
unmasker = pipeline("fill-mask", model="anferico/bert-for-patents")
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
+
from transformers import pipeline, Pipeline
|
4 |
|
5 |
unmasker = pipeline("fill-mask", model="anferico/bert-for-patents")
|
6 |
|
7 |
example = 'A crustless sandwich made from two slices of baked bread'
|
8 |
|
9 |
|
10 |
+
# class TempScalePipe(Pipeline):
|
11 |
+
# def _forward(self, model_inputs):
|
12 |
+
# outputs = self.model(**model_inputs)
|
13 |
+
# return outputs
|
14 |
+
#
|
15 |
+
# def postprocess(self, model_outputs, temp=1e3):
|
16 |
+
# out = model_outputs["logits"] / temp
|
17 |
+
# idx = np.random.randint(-3, 0)
|
18 |
+
# best_class = out.softmax(idx)
|
19 |
+
# return best_class
|
20 |
+
#
|
21 |
|
22 |
def unmask(text):
|
23 |
text = add_mask(text)
|
|
|
28 |
|
29 |
textbox = gr.Textbox(label="Type language here", lines=5)
|
30 |
import gradio as gr
|
31 |
+
from transformers import pipeline, Pipeline
|
32 |
|
33 |
|
34 |
unmasker = pipeline("fill-mask", model="anferico/bert-for-patents")
|