app.py
CHANGED
@@ -1,10 +1,19 @@
|
|
1 |
from fastapi import FastAPI
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
app = FastAPI()
|
8 |
|
9 |
@app.get("/")
|
10 |
def greet_json():
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
3 |
from transformers import pipeline
|
4 |
|
5 |
+
app = FastAPI()
|
6 |
|
7 |
+
app.add_middleware(
|
8 |
+
CORSMiddleware,
|
9 |
+
allow_origins=["*"], # Adjust this if you know the specific origin
|
10 |
+
allow_credentials=True,
|
11 |
+
allow_methods=["*"],
|
12 |
+
allow_headers=["*"],
|
13 |
+
)
|
14 |
+
|
15 |
+
classifier = pipeline("zero-shot-classification", model="valhalla/distilbart-mnli-12-1")
|
16 |
|
|
|
17 |
|
18 |
@app.get("/")
|
19 |
def greet_json():
|