blazingbunny commited on
Commit
a82d9f3
·
verified ·
1 Parent(s): d7e81da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -4,11 +4,20 @@ import streamlit as st # This import is necessary to access secrets and for the
4
  from selenium import webdriver
5
  from chromedriver_binary import add_chromedriver_to_path
6
  from scrapegraphai.graphs import SearchGraph
7
- playwright install
8
 
9
  # Apply necessary settings for asyncio compatibility in Jupyter/Streamlit environments
10
  nest_asyncio.apply()
11
 
 
 
 
 
 
 
 
 
 
12
  # Access your API keys securely
13
  OPENAI_API_KEY = st.secrets["OPENAI_API_KEY"]
14
 
 
4
  from selenium import webdriver
5
  from chromedriver_binary import add_chromedriver_to_path
6
  from scrapegraphai.graphs import SearchGraph
7
+ import subprocess # Import the subprocess module
8
 
9
  # Apply necessary settings for asyncio compatibility in Jupyter/Streamlit environments
10
  nest_asyncio.apply()
11
 
12
+ # Attempt to install Playwright browsers
13
+ try:
14
+ subprocess.run(["playwright", "install"], check=True)
15
+ except subprocess.CalledProcessError as e:
16
+ st.error("Failed to install Playwright: {}".format(e))
17
+
18
+ # Apply necessary settings for asyncio compatibility in Jupyter/Streamlit environments
19
+ nest_asyncio.apply()
20
+
21
  # Access your API keys securely
22
  OPENAI_API_KEY = st.secrets["OPENAI_API_KEY"]
23