lvwerra HF Staff commited on
Commit
7986fba
·
verified ·
1 Parent(s): 14f0e2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -51,8 +51,13 @@ custom_css = """
51
  """
52
 
53
 
54
- def update_placeholder_text():
55
- desktop = Sandbox(api_key=E2B_API_KEY, resolution=(1024, 768), dpi=96)
 
 
 
 
 
56
  desktop.stream.start(require_auth=True)
57
  auth_key = desktop.stream.get_auth_key()
58
  stream_url = desktop.stream.get_url(auth_key=auth_key)
 
51
  """
52
 
53
 
54
+ def update_placeholder_text(request: gr.Request):
55
+
56
+ if request.session_hash not in SANDBOXES:
57
+ SANDBOXES[request.session_hash] = Sandbox(api_key=E2B_API_KEY, resolution=(1024, 768), dpi=96)
58
+ desktop = SANDBOXES[request.session_hash]
59
+
60
+ #desktop = Sandbox(api_key=E2B_API_KEY, resolution=(1024, 768), dpi=96)
61
  desktop.stream.start(require_auth=True)
62
  auth_key = desktop.stream.get_auth_key()
63
  stream_url = desktop.stream.get_url(auth_key=auth_key)