Update app.py
Browse files
app.py
CHANGED
|
@@ -111,17 +111,19 @@ def on_select(space):
|
|
| 111 |
def update_screenshot(url, last_url, force_update=False):
|
| 112 |
print(f"Updating screenshot. Current URL: {url}, Last URL: {last_url}, Force update: {force_update}")
|
| 113 |
if url and (url != last_url or force_update):
|
|
|
|
| 114 |
screenshot = take_screenshot(url)
|
| 115 |
print("Screenshot updated")
|
| 116 |
return screenshot, url
|
| 117 |
print("No update needed")
|
| 118 |
return gr.update(), last_url
|
| 119 |
|
| 120 |
-
|
| 121 |
def refresh_screenshot(url, last_url):
|
| 122 |
print(f"Refresh button clicked. URL: {url}, Last URL: {last_url}")
|
|
|
|
| 123 |
return update_screenshot(url, last_url, force_update=True)
|
| 124 |
-
|
|
|
|
| 125 |
def take_screenshot(url):
|
| 126 |
try:
|
| 127 |
print(f"Taking screenshot of URL: {url}")
|
|
@@ -198,7 +200,7 @@ def create_ui():
|
|
| 198 |
inputs=[url_state, last_url_state],
|
| 199 |
outputs=[screenshot_output, last_url_state]
|
| 200 |
)
|
| 201 |
-
|
| 202 |
|
| 203 |
update_trigger.click(
|
| 204 |
update_screenshot,
|
|
|
|
| 111 |
def update_screenshot(url, last_url, force_update=False):
|
| 112 |
print(f"Updating screenshot. Current URL: {url}, Last URL: {last_url}, Force update: {force_update}")
|
| 113 |
if url and (url != last_url or force_update):
|
| 114 |
+
|
| 115 |
screenshot = take_screenshot(url)
|
| 116 |
print("Screenshot updated")
|
| 117 |
return screenshot, url
|
| 118 |
print("No update needed")
|
| 119 |
return gr.update(), last_url
|
| 120 |
|
|
|
|
| 121 |
def refresh_screenshot(url, last_url):
|
| 122 |
print(f"Refresh button clicked. URL: {url}, Last URL: {last_url}")
|
| 123 |
+
# 항상 강제로 업데이트
|
| 124 |
return update_screenshot(url, last_url, force_update=True)
|
| 125 |
+
|
| 126 |
+
|
| 127 |
def take_screenshot(url):
|
| 128 |
try:
|
| 129 |
print(f"Taking screenshot of URL: {url}")
|
|
|
|
| 200 |
inputs=[url_state, last_url_state],
|
| 201 |
outputs=[screenshot_output, last_url_state]
|
| 202 |
)
|
| 203 |
+
|
| 204 |
|
| 205 |
update_trigger.click(
|
| 206 |
update_screenshot,
|