Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
pipe = pipeline("text-classification",
|
6 |
+
model="airesearch/wangchanbart-large",
|
7 |
+
tokenizer="airesearch/wangchanbart-large"
|
8 |
+
revision="finetuned@wisesight_sentiment"
|
9 |
+
)
|
10 |
+
|
11 |
+
def predict(text):
|
12 |
+
return pipe(text)
|
13 |
+
|
14 |
+
demo = gr.Interface(
|
15 |
+
fn=predict,
|
16 |
+
inputs='text',
|
17 |
+
outputs='text',
|
18 |
+
)
|
19 |
+
|
20 |
+
demo.launch()
|