shahabkahn commited on
Commit
462720c
·
verified ·
1 Parent(s): 5554aed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -15
app.py CHANGED
@@ -20,15 +20,6 @@ from dotenv import load_dotenv
20
  # Load environment variables
21
  load_dotenv()
22
 
23
- # CORS configuration
24
- #app.add_middleware(
25
- #CORSMiddleware,
26
- ##allow_origins=["*"],
27
- #allow_credentials=True,
28
- #allow_methods=["*"],
29
- #allow_headers=["*"],
30
- #)
31
-
32
  # Set up logging
33
  logging.basicConfig(level=logging.INFO)
34
  logger = logging.getLogger(__name__)
@@ -151,16 +142,13 @@ async def query(question_request: QuestionRequest):
151
  raise HTTPException(status_code=500, detail="Internal Server Error")
152
 
153
 
154
- # Define a function to run Streamlit
155
  def run_streamlit():
156
- subprocess.Popen(["streamlit", "run", "frontend.py"])
157
-
158
 
159
  @app.get("/")
160
- async def serve_streamlit(background_tasks: BackgroundTasks):
161
- # Start Streamlit in a background task
162
  background_tasks.add_task(run_streamlit)
163
- return {"message": "Streamlit is starting..."}
164
 
165
 
166
  #if __name__ == '__main__':
 
20
  # Load environment variables
21
  load_dotenv()
22
 
 
 
 
 
 
 
 
 
 
23
  # Set up logging
24
  logging.basicConfig(level=logging.INFO)
25
  logger = logging.getLogger(__name__)
 
142
  raise HTTPException(status_code=500, detail="Internal Server Error")
143
 
144
 
 
145
  def run_streamlit():
146
+ subprocess.Popen(["streamlit", "run", "frontend.py", "--server.port", "8501"])
 
147
 
148
  @app.get("/")
149
+ async def root(background_tasks: BackgroundTasks):
 
150
  background_tasks.add_task(run_streamlit)
151
+ return {"message": "Streamlit app is running at http://localhost:8501"}
152
 
153
 
154
  #if __name__ == '__main__':