vincentiusyoshuac commited on
Commit
fd44661
1 Parent(s): 7e94de8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -1
app.py CHANGED
@@ -1,5 +1,29 @@
1
  import streamlit as st
 
 
 
 
2
  from streamlit_app import create_video_interface
3
 
4
- # Run the Streamlit app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  create_video_interface()
 
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()