Spaces:
Build error
Build error
first commit
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import huggingface
|
2 |
+
from transformers import pipeline
|
3 |
+
import random
|
4 |
+
import gradio as gr
|
5 |
+
from translate import Translator
|
6 |
+
import torch
|
7 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
8 |
+
|
9 |
+
def classfi(input):
|
10 |
+
classifier= pipeline("sentiment-analysis")
|
11 |
+
translator= Translator(from_lang="ko", to_lang="en")
|
12 |
+
inputko=translator.translate(input)
|
13 |
+
|
14 |
+
return classifier(inputko)
|
15 |
+
|
16 |
+
with gr.Blocks(css=".gradio-container {background-color: white}") as demo:
|
17 |
+
name=gr.Textbox(label="ํ๊ณ ์ถ์ ์ด์ผ๊ธฐ๋ฅผ ์ ์ด ๊ฐ์ ๋ถ์ํ๊ธฐ ๋ฒํผ์ ๋๋ฌ๋ณด์ธ์")
|
18 |
+
output=gr.Textbox(label="๋น์ ์ ๊ฐ์ ์ํ๋ฅผ ์๋ ค์ค๋๋ค.")
|
19 |
+
greet_btn = gr.Button("๊ฐ์ ๋ถ์ํ๊ธฐ")
|
20 |
+
greet_btn.click(fn=classfi, inputs=name, outputs=output)
|
21 |
+
demo.launch(debug = True, share = True)
|