win2win commited on
Commit
2e15bb7
·
verified ·
1 Parent(s): 96e62b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -1,6 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from transformers import pipeline
3
 
 
 
4
  model = pipeline("text-classification", model="win2win/3-epochs-classifier-ver2")
5
 
6
  def predict(text):
 
1
+ import subprocess
2
+ import sys
3
+
4
+ def install(package):
5
+ subprocess.check_call([sys.executable, "-m", "pip", "install", package])
6
+
7
+ install("transformers")
8
+ install("torch")
9
+
10
+ from transformers import pipeline
11
+ import gradio as gr
12
+
13
+ model = pipeline("text-classification", model="win2win/3-epochs-classifier-ver2")
14
+
15
+ def predict(text):
16
+ return model(text)
17
+
18
+ gr.Interface(fn=predict, inputs="text", outputs="json").launch()
19
+
20
  import gradio as gr
21
  from transformers import pipeline
22
 
23
+
24
+
25
  model = pipeline("text-classification", model="win2win/3-epochs-classifier-ver2")
26
 
27
  def predict(text):