Created
January 29, 2022 12:39
-
-
Save khaledadrani/59cd28f99e92e0ee4be8418db2db6ab1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
from pydantic import BaseModel | |
from utils.nlp import extract_ents | |
from utils.twitter_api import get_response | |
app = FastAPI() | |
class Query(BaseModel): | |
keyword: str | |
max_results: int | |
@app.get("/") | |
async def root(): | |
return {"message": "Hello to Stock Market NLP Analyzer"} | |
@app.get("/get_tweet_ents") | |
async def root_post(query:Query): | |
return {"query": query} | |
@app.post("/get_tweet_ents") | |
async def get_tweet_ents(query:Query): | |
data = get_response(query.keyword,query.max_results) | |
data = extract_ents(data) | |
return data | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment