import gradio as gr import spaces import torch import subprocess 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()