shahabkahn commited on
Commit
3c4ac4f
·
verified ·
1 Parent(s): d35b64b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import os
2
  import re
3
  import logging
4
- import asyncio, subprocess
5
  from fastapi import FastAPI, HTTPException
6
  from fastapi.responses import RedirectResponse
7
  from pydantic import BaseModel
@@ -11,6 +11,7 @@ from langchain_community.llms import CTransformers
11
  from langchain_community.vectorstores import FAISS
12
  from langchain_community.embeddings import HuggingFaceEmbeddings
13
  from dotenv import load_dotenv
 
14
 
15
  # Load environment variables
16
  load_dotenv()
@@ -112,4 +113,12 @@ async def query(question_request: QuestionRequest):
112
 
113
  @app.get("/")
114
  async def root():
115
- return RedirectResponse(url="https://medical-assist.streamlit.app")
 
 
 
 
 
 
 
 
 
1
  import os
2
  import re
3
  import logging
4
+ import asyncio
5
  from fastapi import FastAPI, HTTPException
6
  from fastapi.responses import RedirectResponse
7
  from pydantic import BaseModel
 
11
  from langchain_community.vectorstores import FAISS
12
  from langchain_community.embeddings import HuggingFaceEmbeddings
13
  from dotenv import load_dotenv
14
+ import subprocess
15
 
16
  # Load environment variables
17
  load_dotenv()
 
113
 
114
  @app.get("/")
115
  async def root():
116
+ return RedirectResponse(url="/docs")
117
+
118
+ @app.on_event("startup")
119
+ async def startup_event():
120
+ subprocess.Popen(["streamlit", "run", "frontend.py", "--server.port", "8501"])
121
+
122
+ if __name__ == '__main__':
123
+ import uvicorn
124
+ uvicorn.run(app, host='0.0.0.0', port=7860)