Spaces:
Running
on
Zero
Running
on
Zero
import gradio as gr | |
import spaces | |
import torch | |
import subprocess | |
import numpy as np | |
zero = torch.Tensor([0]).cuda() | |
print(zero.device) # <-- 'cpu' π€ | |
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() |