Spaces:
Running
Running
Trisha Tomy
commited on
Commit
·
8b9bbfa
1
Parent(s):
0b5b38e
Explicitly instantiate RecorderConfig to ensure root_path is set
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ gevent.monkey.patch_all(asyncio=True)
|
|
4 |
import asyncio
|
5 |
from flask import Flask, request, jsonify
|
6 |
from proxy_lite import Runner, RunnerConfig
|
|
|
7 |
import os
|
8 |
import logging
|
9 |
|
@@ -23,13 +24,15 @@ async def initialize_runner():
|
|
23 |
logger.error("HF_API_TOKEN environment variable not set. Cannot initialize Runner.")
|
24 |
raise ValueError("HF_API_TOKEN environment variable not set. Please set it as a Space secret.")
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
"name": "webbrowser",
|
29 |
"homepage": "https://www.google.com",
|
30 |
"headless": True,
|
31 |
},
|
32 |
-
|
33 |
"name": "simple",
|
34 |
"agent": {
|
35 |
"name": "proxy_lite",
|
@@ -41,10 +44,8 @@ async def initialize_runner():
|
|
41 |
}
|
42 |
}
|
43 |
},
|
44 |
-
|
45 |
-
|
46 |
-
}
|
47 |
-
})
|
48 |
_runner = Runner(config=config)
|
49 |
logger.info("Proxy-lite Runner initialized successfully.")
|
50 |
return _runner
|
|
|
4 |
import asyncio
|
5 |
from flask import Flask, request, jsonify
|
6 |
from proxy_lite import Runner, RunnerConfig
|
7 |
+
from proxy_lite.config import RecorderConfig
|
8 |
import os
|
9 |
import logging
|
10 |
|
|
|
24 |
logger.error("HF_API_TOKEN environment variable not set. Cannot initialize Runner.")
|
25 |
raise ValueError("HF_API_TOKEN environment variable not set. Please set it as a Space secret.")
|
26 |
|
27 |
+
recorder_config_instance = RecorderConfig(root_path="/tmp/proxy_lite_runs")
|
28 |
+
|
29 |
+
config = RunnerConfig(
|
30 |
+
environment={
|
31 |
"name": "webbrowser",
|
32 |
"homepage": "https://www.google.com",
|
33 |
"headless": True,
|
34 |
},
|
35 |
+
solver={
|
36 |
"name": "simple",
|
37 |
"agent": {
|
38 |
"name": "proxy_lite",
|
|
|
44 |
}
|
45 |
}
|
46 |
},
|
47 |
+
recorder=recorder_config_instance # Pass the explicitly created instance
|
48 |
+
)
|
|
|
|
|
49 |
_runner = Runner(config=config)
|
50 |
logger.info("Proxy-lite Runner initialized successfully.")
|
51 |
return _runner
|