File size: 390 Bytes
3a9b68a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import asyncio
import uvicorn
from app import demo
from api import app

async def run_servers():
    config = uvicorn.Config(app=app, host="0.0.0.0", port=8000)
    server = uvicorn.Server(config)
    fastapi_task = asyncio.create_task(server.serve())
    demo.launch(server_name="0.0.0.0", server_port=7860)
    await fastapi_task

if __name__ == "__main__":
    asyncio.run(run_servers())