Krish Patel commited on
Commit
427cf32
·
1 Parent(s): 6b30efd

Added api endpoint 2

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -137,9 +137,19 @@ from pydantic import BaseModel
137
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
138
  import torch
139
 
 
 
 
140
  # Define the FastAPI app
141
  app = FastAPI()
142
 
 
 
 
 
 
 
 
143
  # Define the input data schema
144
  class InputText(BaseModel):
145
  text: str
 
137
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
138
  import torch
139
 
140
+ from fastapi.middleware.cors import CORSMiddleware
141
+
142
+
143
  # Define the FastAPI app
144
  app = FastAPI()
145
 
146
+ app.add_middleware(
147
+ CORSMiddleware,
148
+ allow_origins=["*"], # Update with your frontend's URL for security
149
+ allow_credentials=True,
150
+ allow_methods=["*"],
151
+ allow_headers=["*"],
152
+ )
153
  # Define the input data schema
154
  class InputText(BaseModel):
155
  text: str