Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
#gr.Interface.load("models/hipnologo/gpt2-imdb-finetune").launch()
|
3 |
-
import gradio as gr
|
4 |
|
5 |
-
def postprocess_label(
|
6 |
-
|
|
|
7 |
return "Negative"
|
8 |
-
elif
|
9 |
return "Positive"
|
10 |
else:
|
11 |
return "Unknown label"
|
12 |
|
13 |
iface = gr.Interface.load("models/hipnologo/gpt2-imdb-finetune")
|
14 |
-
iface.
|
15 |
-
|
16 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
#gr.Interface.load("models/hipnologo/gpt2-imdb-finetune").launch()
|
|
|
3 |
|
4 |
+
def postprocess_label(model, inp):
|
5 |
+
result = model(inp)
|
6 |
+
if result == "LABEL_0":
|
7 |
return "Negative"
|
8 |
+
elif result == "LABEL_1":
|
9 |
return "Positive"
|
10 |
else:
|
11 |
return "Unknown label"
|
12 |
|
13 |
iface = gr.Interface.load("models/hipnologo/gpt2-imdb-finetune")
|
14 |
+
iface.fn = lambda inp: postprocess_label(iface.fn, inp)
|
|
|
15 |
iface.launch()
|