Spaces:
Runtime error
Runtime error
Yash Sachdeva
commited on
Commit
·
7338a55
1
Parent(s):
1720d8c
cors
Browse files- question_paper.py +12 -0
question_paper.py
CHANGED
@@ -5,12 +5,24 @@ from fastapi import FastAPI, Response
|
|
5 |
|
6 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
7 |
|
|
|
|
|
8 |
app = FastAPI()
|
9 |
|
10 |
MODEL = None
|
11 |
TOKENIZER = None
|
12 |
# ?input=%22Name%203%20shows%22
|
13 |
origins = ['https://aiforall.netlify.app/']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
@app.get("/")
|
15 |
def llama():
|
16 |
# prompt = [{'role': 'user', 'content': ""+input}]
|
|
|
5 |
|
6 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
7 |
|
8 |
+
from fastapi.middleware.cors import CORSMiddleware
|
9 |
+
|
10 |
app = FastAPI()
|
11 |
|
12 |
MODEL = None
|
13 |
TOKENIZER = None
|
14 |
# ?input=%22Name%203%20shows%22
|
15 |
origins = ['https://aiforall.netlify.app/']
|
16 |
+
|
17 |
+
app.add_middleware(
|
18 |
+
CORSMiddleware,
|
19 |
+
allow_origins=origins,
|
20 |
+
allow_credentials=True,
|
21 |
+
allow_methods=["*"],
|
22 |
+
allow_headers=["*"],
|
23 |
+
)
|
24 |
+
|
25 |
+
|
26 |
@app.get("/")
|
27 |
def llama():
|
28 |
# prompt = [{'role': 'user', 'content': ""+input}]
|