File size: 993 Bytes
ec23308 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
#Code
from fastapi import FastAPI
import nest_asyncio
#from pyngrok import ngrok
import uvicorn
#from transformers import pipeline
#model_path = "cardiffnlp/twitter-roberta-base-sentiment-latest"
#sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
@app.get('/enwi')
async def abc():
st = ''
for i in range(10):
st += str(i * 2) + " "
return st
#@app.get('/sentiment/{intput_text}')
#async def mlmodel(intput_text):
#
# result = sentiment_task(intput_text)
# return result
@app.get('/a/{name}/{password}')
async def abc(name, password):
if int(password) == 123 and name == "abc":
return "Correct password"
else:
return "Incorrect Password"
@app.get('/')
async def home():
return "Hello Atom Camp"
#ngrok_tunnel = ngrok.connect(8000)
#print('Public URL:', ngrok_tunnel.public_url)
nest_asyncio.apply()
#uvicorn.run(app, port=8000)
|