yukiapple323 commited on
Commit
839b04b
·
verified ·
1 Parent(s): 429fe63

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +11 -10
index.html CHANGED
@@ -24,22 +24,22 @@ import gradio as gr
24
  from transformers_js_py import pipeline
25
  from filters import convert
26
 
27
- # 기존 파이프라인은 object-detection을 사용하므로, 새로운 파이프라인을 생성하여 koelectra-base-v3-discriminator 모델을 사용하도록 수정합니다.
28
- pipe = await pipeline('sentiment-analysis', 'monologg/koelectra-base-v3-discriminator')
 
29
 
30
- async def fn(text):
31
- result = await pipe(text)
32
- return result
33
 
34
  async def predict(text):
35
  result = await pipe(text)
36
- return result['label'], result['score']
37
 
38
  demo = gr.Interface(
39
  fn=predict,
40
- inputs=gr.Textbox(lines=7, label="Input Text"),
41
- outputs="label",
42
- title='Sentiment Analysis with KoELECTRA Model'
43
  )
44
 
45
  demo.launch()
@@ -74,8 +74,9 @@ def convert(input_data):
74
 
75
  <gradio-requirements>
76
  # Same syntax as requirements.txt
77
- transformers_js_py
78
  </gradio-requirements>
79
  </gradio-lite>
80
  </body>
81
  </html>
 
 
24
  from transformers_js_py import pipeline
25
  from filters import convert
26
 
27
+ # 모델과 tokenizer 파일 경로
28
+ model_name = 'monologg/koelectra-base-v3-discriminator'
29
+ tokenizer_path = 'tokenizer.json'
30
 
31
+ # 모델 및 tokenizer 로드
32
+ pipe = await pipeline('sentiment-analysis', model_name, tokenizer=tokenizer_path)
 
33
 
34
  async def predict(text):
35
  result = await pipe(text)
36
+ return result
37
 
38
  demo = gr.Interface(
39
  fn=predict,
40
+ inputs="text",
41
+ outputs="text",
42
+ title="KoELECTRA Sentiment Analysis"
43
  )
44
 
45
  demo.launch()
 
74
 
75
  <gradio-requirements>
76
  # Same syntax as requirements.txt
77
+ transformers-js-py
78
  </gradio-requirements>
79
  </gradio-lite>
80
  </body>
81
  </html>
82
+