Update main.py
Browse files
main.py
CHANGED
@@ -26,8 +26,6 @@ import pptx
|
|
26 |
import os
|
27 |
import utils
|
28 |
import shutil
|
29 |
-
import nest_asyncio
|
30 |
-
from pyngrok import conf, ngrok
|
31 |
|
32 |
## APPLICATION LIFESPAN
|
33 |
# Load the environment variables using FastAPI lifespan event so that they are available throughout the application
|
@@ -369,22 +367,4 @@ async def get_answer_with_chat_history(llm: str, question: Question):
|
|
369 |
# Handle errors
|
370 |
raise HTTPException(status_code=500, detail=str(e))
|
371 |
|
372 |
-
return response
|
373 |
-
|
374 |
-
# Set HOME environment variable
|
375 |
-
os.environ["HOME"] = "/app"
|
376 |
-
|
377 |
-
# Set ngrok binary path
|
378 |
-
# ngrok.set_ngrok_path(os.path.expanduser("~/.ngrok2/ngrok"))
|
379 |
-
conf.get_default().ngrok_path = "/usr/local/bin/ngrok"
|
380 |
-
|
381 |
-
# Set ngrok authentication token
|
382 |
-
ngrok.set_auth_token(os.environ['NGROK_AUTHTOKEN'])
|
383 |
-
|
384 |
-
# Establish ngrok tunnel
|
385 |
-
ngrok_tunnel = ngrok.connect(7860)
|
386 |
-
print('Public URL:', ngrok_tunnel.public_url)
|
387 |
-
|
388 |
-
# Run FastAPI server using uvicorn
|
389 |
-
nest_asyncio.apply()
|
390 |
-
uvicorn.run(app, port=7860)
|
|
|
26 |
import os
|
27 |
import utils
|
28 |
import shutil
|
|
|
|
|
29 |
|
30 |
## APPLICATION LIFESPAN
|
31 |
# Load the environment variables using FastAPI lifespan event so that they are available throughout the application
|
|
|
367 |
# Handle errors
|
368 |
raise HTTPException(status_code=500, detail=str(e))
|
369 |
|
370 |
+
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|