import gradio as gr import os import subprocess folder_path = 'src/server' file_name = 'main.cs' file_path = os.path.join(folder_path, file_name) os.makedirs(folder_path, exist_ok=True) open('roblox-cs.yml', 'w').write("""SourceFolder: src OutputFolder: dist EmitNativeAttributeOnClassOrNamespaceCallbacks: true EnabledBuiltInTransformers: - Debug CSharpOptions: EntryPointRequired: false EntryPointName: Game MainMethodName: Main AssemblyName: ExampleProject""") def compile(cs): # Create file with open(file_path, 'w') as file: file.write(cs) # Run command try: result = subprocess.run( ['dotnet', 'run'], capture_output=True, text=True, check=True ) except subprocess.CalledProcessError as e: gr.Error(f"Error: `{e.stderr}`, Exit Status: {e.returncode}") return 'ha' demo = gr.Interface(fn=compile, inputs="text", outputs="text") demo.launch()