osanseviero
commited on
Commit
•
eee041e
1
Parent(s):
f62e0db
Update README.md
Browse files
README.md
CHANGED
@@ -4,4 +4,34 @@ library_name: "transformers.js"
|
|
4 |
|
5 |
https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english with ONNX weights to be compatible with Transformers.js.
|
6 |
|
7 |
-
Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english with ONNX weights to be compatible with Transformers.js.
|
6 |
|
7 |
+
Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
|
8 |
+
|
9 |
+
<html>
|
10 |
+
<head>
|
11 |
+
<script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js"></script>
|
12 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.css" />
|
13 |
+
</head>
|
14 |
+
</html>
|
15 |
+
|
16 |
+
<gradio-lite>
|
17 |
+
|
18 |
+
<gradio-requirements>
|
19 |
+
transformers_js_py
|
20 |
+
</gradio-requirements>
|
21 |
+
|
22 |
+
<gradio-file name="app.py" entrypoint>
|
23 |
+
from transformers_js import import_transformers_js
|
24 |
+
import gradio as gr
|
25 |
+
|
26 |
+
transformers = await import_transformers_js()
|
27 |
+
pipeline = transformers.pipeline
|
28 |
+
pipe = await pipeline('sentiment-analysis', 'osanseviero/distilbert-base-uncased-finetuned-quantized')
|
29 |
+
|
30 |
+
async def classify(text):
|
31 |
+
return await pipe(text)
|
32 |
+
|
33 |
+
demo = gr.Interface(classify, "textbox", "json")
|
34 |
+
demo.launch()
|
35 |
+
</gradio-file>
|
36 |
+
|
37 |
+
</gradio-lite>
|