Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
pipe = await pipeline('sentiment-analysis')
|
| 7 |
-
|
| 8 |
-
async def classify(text):
|
| 9 |
-
return await pipe(text)
|
| 10 |
-
|
| 11 |
-
demo = gr.Interface(classify, "textbox", "json")
|
| 12 |
-
demo.launch()
|
|
|
|
| 1 |
+
from transformers_js import import_transformers_js
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
transformers = await import_transformers_js()
|
| 5 |
+
pipeline = transformers.pipeline
|
| 6 |
+
pipe = await pipeline('sentiment-analysis')
|
| 7 |
+
|
| 8 |
+
async def classify(text):
|
| 9 |
+
return await pipe(text)
|
| 10 |
|
| 11 |
+
demo = gr.Interface(classify, "textbox", "json")
|
| 12 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|