yukiapple323 commited on
Commit
8c34d2d
·
verified ·
1 Parent(s): 78fdf5c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +18 -14
index.html CHANGED
@@ -24,24 +24,28 @@ import gradio as gr
24
  from transformers_js_py import pipeline
25
  from filters import convert
26
 
27
- # 모델과 tokenizer 파일 경로
28
- model_path = 'model/'
29
- tokenizer_path = 'tokenizer.json'
30
 
31
- # 모델 및 tokenizer 로드
32
- pipe = await pipeline('sentiment-analysis', model_path, 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()
46
  </gradio-file>
47
 
@@ -78,4 +82,4 @@ 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
+ pipe = await pipeline('object-detection', 'Xenova/detr-resnet-50')
 
 
28
 
29
+ async def fn(image):
30
+ result = await pipe(image)
31
+ return result
32
+
33
+ #demo = gr.Interface.from_pipeline(pipe)
34
 
35
+ async def predict(image):
36
+ result = await pipe(image)
37
+ print(result)
38
+ result = convert(result)
39
+ print(result)
40
+ return image, result
41
 
42
  demo = gr.Interface(
43
+ fn=predict,
44
+ inputs=gr.Image(type='pil'),
45
+ outputs=gr.AnnotatedImage(),
46
+ title='On-Device Object-Detection with Gradio-Lite & Transformers.js'
47
  )
48
+
49
  demo.launch()
50
  </gradio-file>
51
 
 
82
  </gradio-requirements>
83
  </gradio-lite>
84
  </body>
85
+ </html>