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