Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -151,18 +151,16 @@ async def query(question_request: QuestionRequest):
|
|
| 151 |
raise HTTPException(status_code=500, detail="Internal Server Error")
|
| 152 |
|
| 153 |
|
| 154 |
-
# Define a function to run
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
#
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
#streamlit_output = subprocess.Popen(["streamlit", "run", "frontend.py", "--server.port"], stdout=subprocess.PIPE)
|
| 165 |
-
#return StreamingResponse(streamlit_output.stdout, media_type="text/plain")
|
| 166 |
|
| 167 |
|
| 168 |
#if __name__ == '__main__':
|
|
|
|
| 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__':
|