-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
Currently it shows the browser everytime. It is due to the configuration. However headless Chrome could have issues when browsing certain websites.
I made some changes to src/proxy_lite/app.py. I also grab some environment variables into the config for easier manipulation.
--- a/src/proxy_lite/app.py
+++ b/src/proxy_lite/app.py
@@ -1,12 +1,13 @@
import asyncio
import base64
from io import BytesIO
+import os
import streamlit as st
from PIL import Image
from proxy_lite import Runner, RunnerConfig
-
+from pyvirtualdisplay import Display
def get_user_config(config_expander):
config = {
@@ -18,9 +19,9 @@ def get_user_config(config_expander):
"viewport_width": 1280,
"viewport_height": 1920,
"include_poi_text": True,
- "homepage": "https://www.google.com",
- "keep_original_image": False,
- "headless": False, # without proxies headless mode often results in getting bot blocked
+ "homepage": os.environ.get("HOMEPAGE", "https://www.google.com"),
+ "keep_original_image": False,
+ "headless": False, # without proxies headless mode often results in getting bot blocked, but we use virtual display so it would not annoy us
},
"solver": {
"name": "simple",
@@ -29,7 +30,7 @@ def get_user_config(config_expander):
"client": {
"name": "convergence",
"model_id": "convergence-ai/proxy-lite-3b",
- "api_base": "https://convergence-ai-demo-api.hf.space/v1",
+ "api_base": os.environ.get("PROXY_LITE_API_BASE","https://convergence-ai-demo-api.hf.space/v1"),
},
},
},
@@ -209,28 +210,29 @@ def main():
if submit_button:
st.session_state.config_expanded = False
if task:
- # Create placeholders for dynamic updates
- status_placeholder = st.empty()
- st.write(" ")
- action_placeholder = st.empty()
- environment_placeholder = st.empty()
- image_placeholder = st.empty()
- history_placeholder = st.empty()
-
- # Run the async task
- asyncio.run(
- run_task_async(
- task,
- status_placeholder,
- action_placeholder,
- environment_placeholder,
- image_placeholder,
- history_placeholder,
- config,
- ),
- )
-
- st.success("Task completed!", icon="✨")
+ with Display() as disp:
+ # Create placeholders for dynamic updates
+ status_placeholder = st.empty()
+ st.write(" ")
+ action_placeholder = st.empty()
+ environment_placeholder = st.empty()
+ image_placeholder = st.empty()
+ history_placeholder = st.empty()
+
+ # Run the async task
+ asyncio.run(
+ run_task_async(
+ task,
+ status_placeholder,
+ action_placeholder,
+ environment_placeholder,
+ image_placeholder,
+ history_placeholder,
+ config,
+ ),
+ )
+
+ st.success("Task completed!", icon="✨")
else:
st.error("Please give a task first!")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels