Spaces:
Build error
Build error
Raymond Weitekamp commited on
Commit ·
a2e1cac
1
Parent(s): 35ad182
Use Hugging Face Spaces proxy URL for viewer iframe
Browse files- cadviewer.py +3 -2
cadviewer.py
CHANGED
|
@@ -97,7 +97,7 @@ def check_viewer_ready():
|
|
| 97 |
"""Check if the viewer is ready by attempting a test connection"""
|
| 98 |
try:
|
| 99 |
import requests
|
| 100 |
-
#
|
| 101 |
response = requests.get('http://localhost:3939/viewer')
|
| 102 |
return response.status_code == 200
|
| 103 |
except:
|
|
@@ -188,9 +188,10 @@ with ui.splitter().classes(
|
|
| 188 |
with ui.column().classes("w-full items-stretch border"):
|
| 189 |
# Add a small delay before loading the iframe
|
| 190 |
ui.timer(3.0, lambda: None, once=True) # Wait for viewer to be ready
|
|
|
|
| 191 |
ocpcv = (
|
| 192 |
ui.element("iframe")
|
| 193 |
-
.props('src="
|
| 194 |
.classes("h-[calc(100vh-3rem)]")
|
| 195 |
)
|
| 196 |
|
|
|
|
| 97 |
"""Check if the viewer is ready by attempting a test connection"""
|
| 98 |
try:
|
| 99 |
import requests
|
| 100 |
+
# Check from inside the container using localhost
|
| 101 |
response = requests.get('http://localhost:3939/viewer')
|
| 102 |
return response.status_code == 200
|
| 103 |
except:
|
|
|
|
| 188 |
with ui.column().classes("w-full items-stretch border"):
|
| 189 |
# Add a small delay before loading the iframe
|
| 190 |
ui.timer(3.0, lambda: None, once=True) # Wait for viewer to be ready
|
| 191 |
+
# Use relative URL to work in any environment
|
| 192 |
ocpcv = (
|
| 193 |
ui.element("iframe")
|
| 194 |
+
.props('src="/proxy/3939/viewer"') # Use Spaces proxy URL
|
| 195 |
.classes("h-[calc(100vh-3rem)]")
|
| 196 |
)
|
| 197 |
|