import gradio as gr import spaces import torch import subprocess import numpy as np print(torch.cuda.is_available()) # <-- True 🤗 print(torch.cuda.device_count()) # <-- 1 🤗 print(torch.cuda.get_device_name()) # <-- 'A10G' 🤗 @spaces.GPU def start_ochat_server(): # 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()