vincentiusyoshuac commited on
Commit
c4a7f26
1 Parent(s): 17ea9fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -21
app.py CHANGED
@@ -1,29 +1,15 @@
1
- import streamlit as st
2
- import uvicorn
3
- from fastapi import FastAPI
4
- from fastapi.middleware.cors import CORSMiddleware
5
  import threading
 
 
 
6
  from streamlit_app import create_video_interface
7
 
8
- # Initialize FastAPI
9
- app = FastAPI()
10
-
11
- # Enable CORS
12
- app.add_middleware(
13
- CORSMiddleware,
14
- allow_origins=["*"],
15
- allow_credentials=True,
16
- allow_methods=["*"],
17
- allow_headers=["*"],
18
- )
19
-
20
- # Run FastAPI in a separate thread
21
  def run_fastapi():
22
- uvicorn.run(app, host="0.0.0.0", port=7860)
23
 
24
- # Start FastAPI server
25
- fastapi_thread = threading.Thread(target=run_fastapi, daemon=True)
26
  fastapi_thread.start()
27
 
28
- # Run Streamlit app
29
  create_video_interface()
 
 
 
 
 
1
  import threading
2
+ import uvicorn
3
+ import streamlit as st
4
+ from fastapi_app import app as fastapi_app
5
  from streamlit_app import create_video_interface
6
 
7
+ # Run the FastAPI server in a separate thread
 
 
 
 
 
 
 
 
 
 
 
 
8
  def run_fastapi():
9
+ uvicorn.run(fastapi_app, host="0.0.0.0", port=7860)
10
 
11
+ fastapi_thread = threading.Thread(target=run_fastapi)
 
12
  fastapi_thread.start()
13
 
14
+ # Run the Streamlit app
15
  create_video_interface()