File size: 679 Bytes
3fb3713
 
 
 
 
 
 
 
 
 
 
 
5a59bfd
3fb3713
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
import subprocess
import threading
import uvicorn
from fastapi import FastAPI
from app import app as fastapi_app

# Run playwright install ONCE at startup
subprocess.run(["playwright", "install", "chromium"])

# Start FastAPI in a separate thread
def run_fastapi():
    uvicorn.run(fastapi_app, host="0.0.0.0", port=7861)

threading.Thread(target=run_fastapi, daemon=True).start()

# Optional: a small Gradio demo
def query_operator(number):
    from worker import get_operator
    return get_operator(number)

demo = gr.Interface(fn=query_operator, inputs="text", outputs="text", title="Mobile Operator Lookup")

if __name__ == "__main__":
    demo.launch()