ver Dec20th

fixed bug caused by windows-only os.startfile
This commit is contained in:
David Chang
2023-12-20 20:55:47 +08:00
parent b37df609b9
commit f4949c3e90
2 changed files with 9 additions and 4 deletions

View File

@@ -4,9 +4,10 @@ import platform
import subprocess
import requests
import Xlib.display
#import Xlib.display
import pyautogui
from PIL import ImageGrab, Image
#from PIL import ImageGrab, Image
from PIL import Image
from flask import Flask, request, jsonify, send_file
app = Flask(__name__)
@@ -180,7 +181,11 @@ def open_file():
return f"File not found: {path}", 404
try:
os.startfile(path)
if platform.system()=="Windows":
os.startfile(path)
else:
open_cmd: str = "open" if platform.system()=="Darwin" else "xdg-open"
subprocess.Popen([open_cmd, str(path)])
return "File opened successfully"
except Exception as e:
return f"Failed to open {path}. Error: {e}", 500

View File

@@ -15,7 +15,7 @@ def human_agent():
env = DesktopEnv( path_to_vm="/home/david/vmware/KUbuntu 64-bit/KUbuntu 64-bit.vmx"
, action_space="computer_13"
#, snapshot_path="base_setup"
, snapshot_path="Init5"
, snapshot_path="Init6"
, instruction=example["instruction"]
, config=example["config"]
, evaluator=example["evaluator"]