ghostv1 / app.py
Jagrut Thakare
v1
6d92c79
raw
history blame
842 Bytes
import os, sys, subprocess
import gradio as gr
def setup_gpu_deps():
pkg_dir = os.path.expanduser("~/.local/gpu_packages")
os.makedirs(pkg_dir, exist_ok=True)
subprocess.run([
sys.executable, "-m", "pip", "install",
"--upgrade", "--target", pkg_dir,
"torch", "torchvision", "torchaudio",
"--extra-index-url", "https://download.pytorch.org/whl/cu118"
], check=True)
subprocess.run([
sys.executable, "-m", "pip", "install",
"--upgrade", "mxnet-cu112", "onnxruntime-gpu==1.12", "Cython", "insightface==0.2.1", "kornia==0.5.4", "dill"
], check=True)
sys.path.insert(0, pkg_dir)
setup_gpu_deps()
def infer(input_text):
return "hello this is test"
iface = gr.Interface(fn=infer, inputs="text", outputs="text")
iface.launch(server_name="0.0.0.0", server_port=7860)