macadeliccc's picture
test
71b7f64
raw
history blame
742 Bytes
import gradio as gr
import spaces
import torch
import subprocess
import numpy as np
zero = torch.Tensor([0]).cuda()
print(zero.device) # <-- 'cpu' πŸ€”
@spaces.GPU
def start_ochat_server():
print(zero.device) # <-- 'cuda:0' πŸ€—
# Command to start the ochat inference server
command = [
"python", "-m", "ochat.serving.openai_api_server",
"--model", "openchat/openchat_3.5"
]
# Start the server
try:
# Use subprocess to run the command
subprocess.Popen(command)
return "ochat server started successfully"
except Exception as e:
return f"Failed to start ochat server: {e}"
gr.Interface(fn=start_ochat_server, inputs=gr.Number(), outputs=gr.Text()).launch()