Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
The required code for running the ngrok application on google colab is added so that it doesn't create any issues or errors.
  • Loading branch information
Demogorgon24242 authored Jun 23, 2023
1 parent 8b455f3 commit 007f77a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
from starlette.responses import RedirectResponse
from fastapi.responses import Response
from textSummarizer.pipeline.prediction import PredictionPipeline


import nest_asyncio
from pyngrok import ngrok
import uvicorn
from fastapi.middleware.cors import CORSMiddleware
text:str = "What is Text Summarization?"

app = FastAPI()

app.add_middleware(
CORSMiddleware,
allow_origins=['*'],
allow_credentials=True,
allow_methods=['*'],
allow_headers=['*'],
)
@app.get("/", tags=["authentication"])
async def index():
return RedirectResponse(url="/docs")
Expand Down Expand Up @@ -42,4 +51,7 @@ async def predict_route(text):


if __name__=="__main__":
uvicorn.run(app, host="0.0.0.0", port=8080)
ngrok_tunnel = ngrok.connect(3000)
print('Public URL:', ngrok_tunnel.public_url)
nest_asyncio.apply()
uvicorn.run(app, port=3000)

0 comments on commit 007f77a

Please sign in to comment.