Update index.html
Browse files- 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 |
-
|
28 |
-
model_path = 'model/'
|
29 |
-
tokenizer_path = 'tokenizer.json'
|
30 |
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
-
async def predict(
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
37 |
|
38 |
demo = gr.Interface(
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
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>
|