win2win commited on
Commit
7328228
·
verified ·
1 Parent(s): c504ae3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -7,16 +7,21 @@ def install(package):
7
  install("transformers")
8
  install("torch")
9
 
 
 
 
 
10
 
11
- from fastapi import FastAPI
 
 
 
 
 
12
  from transformers import pipeline
13
 
14
- app = FastAPI()
15
 
16
- # Load your Hugging Face model
17
  model = pipeline("text-classification", model="win2win/3-epochs-classifier-ver2")
18
 
19
- # Define a POST endpoint at `/predict`
20
- @app.post("/predict")
21
- async def predict(text: str):
22
- return model(text)
 
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):