Spaces:
Runtime error
Runtime error
Commit
·
639a660
1
Parent(s):
2b6080b
format playwight
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ from playwright.async_api import async_playwright
|
|
67 |
|
68 |
os.environ['MPLCONFIGDIR'] = os.path.expanduser('/home/user/matplotlib_cache')
|
69 |
|
70 |
-
async def start_playwright():
|
71 |
pw = await async_playwright().start()
|
72 |
browser = await pw.chromium.launch(headless=True)
|
73 |
# browser = await pw.webkit.launch(headless=True)
|
@@ -81,7 +81,7 @@ async def start_playwright():
|
|
81 |
# print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_html())
|
82 |
print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_text())
|
83 |
|
84 |
-
await page.locator("//textarea").fill(
|
85 |
await page.wait_for_timeout(200)
|
86 |
# print("Content of Web: ", await page.content())
|
87 |
# await page.locator("//button[@class='css-1wi2cd3 e1d2x3se3']").click()
|
@@ -1276,7 +1276,8 @@ if __name__ == '__main__':
|
|
1276 |
# QAQuery("what is COFOR ?")
|
1277 |
# CreatDb_P()
|
1278 |
# QAQuery_p("what is GST ?")
|
1279 |
-
|
|
|
1280 |
if SysLock == "1":
|
1281 |
demo.queue().launch(auth=(username, password), server_name="0.0.0.0", server_port=7860)
|
1282 |
else:
|
|
|
67 |
|
68 |
os.environ['MPLCONFIGDIR'] = os.path.expanduser('/home/user/matplotlib_cache')
|
69 |
|
70 |
+
async def start_playwright(question: str):
|
71 |
pw = await async_playwright().start()
|
72 |
browser = await pw.chromium.launch(headless=True)
|
73 |
# browser = await pw.webkit.launch(headless=True)
|
|
|
81 |
# print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_html())
|
82 |
print("Test content: ", await page.locator("//div[@class='css-zt5igj e1nzilvr3']").inner_text())
|
83 |
|
84 |
+
await page.locator("//textarea").fill(question)
|
85 |
await page.wait_for_timeout(200)
|
86 |
# print("Content of Web: ", await page.content())
|
87 |
# await page.locator("//button[@class='css-1wi2cd3 e1d2x3se3']").click()
|
|
|
1276 |
# QAQuery("what is COFOR ?")
|
1277 |
# CreatDb_P()
|
1278 |
# QAQuery_p("what is GST ?")
|
1279 |
+
question = "what is PDP?"
|
1280 |
+
output = asyncio.run(start_playwright(question))
|
1281 |
if SysLock == "1":
|
1282 |
demo.queue().launch(auth=(username, password), server_name="0.0.0.0", server_port=7860)
|
1283 |
else:
|