Update app.py
Browse files
app.py
CHANGED
|
@@ -50,6 +50,18 @@ custom_css = """
|
|
| 50 |
}
|
| 51 |
"""
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
def update_placeholder_text(request: gr.Request):
|
| 55 |
|
|
@@ -62,18 +74,7 @@ def update_placeholder_text(request: gr.Request):
|
|
| 62 |
auth_key = desktop.stream.get_auth_key()
|
| 63 |
stream_url = desktop.stream.get_url(auth_key=auth_key)
|
| 64 |
|
| 65 |
-
html_content =
|
| 66 |
-
<div class="sandbox-outer-wrapper">
|
| 67 |
-
<div class="sandbox-container">
|
| 68 |
-
<img src="https://huggingface.co/datasets/lvwerra/admin/resolve/main/desktop_scaled.png" class="sandbox-background" />
|
| 69 |
-
<iframe
|
| 70 |
-
src="{stream_url}"
|
| 71 |
-
class="sandbox-iframe"
|
| 72 |
-
allowfullscreen>
|
| 73 |
-
</iframe>
|
| 74 |
-
</div>
|
| 75 |
-
</div>
|
| 76 |
-
"""
|
| 77 |
return html_content
|
| 78 |
|
| 79 |
# Create a Gradio app with Blocks
|
|
@@ -82,7 +83,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 82 |
|
| 83 |
# HTML output with simulated image and iframe
|
| 84 |
html_output = gr.HTML(
|
| 85 |
-
value=
|
| 86 |
label="Output"
|
| 87 |
)
|
| 88 |
|
|
@@ -101,7 +102,8 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 101 |
inputs=None,
|
| 102 |
outputs=[html_output]
|
| 103 |
)
|
| 104 |
-
|
|
|
|
| 105 |
|
| 106 |
# Launch the app
|
| 107 |
if __name__ == "__main__":
|
|
|
|
| 50 |
}
|
| 51 |
"""
|
| 52 |
|
| 53 |
+
html_template = """
|
| 54 |
+
<div class="sandbox-outer-wrapper">
|
| 55 |
+
<div class="sandbox-container">
|
| 56 |
+
<img src="https://huggingface.co/datasets/lvwerra/admin/resolve/main/desktop_scaled.png" class="sandbox-background" />
|
| 57 |
+
<iframe
|
| 58 |
+
src="{stream_url}"
|
| 59 |
+
class="sandbox-iframe"
|
| 60 |
+
allowfullscreen>
|
| 61 |
+
</iframe>
|
| 62 |
+
</div>
|
| 63 |
+
</div>"""
|
| 64 |
+
|
| 65 |
|
| 66 |
def update_placeholder_text(request: gr.Request):
|
| 67 |
|
|
|
|
| 74 |
auth_key = desktop.stream.get_auth_key()
|
| 75 |
stream_url = desktop.stream.get_url(auth_key=auth_key)
|
| 76 |
|
| 77 |
+
html_content = html_template.format(stream_url=stream_url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
return html_content
|
| 79 |
|
| 80 |
# Create a Gradio app with Blocks
|
|
|
|
| 83 |
|
| 84 |
# HTML output with simulated image and iframe
|
| 85 |
html_output = gr.HTML(
|
| 86 |
+
value=html_template,
|
| 87 |
label="Output"
|
| 88 |
)
|
| 89 |
|
|
|
|
| 102 |
inputs=None,
|
| 103 |
outputs=[html_output]
|
| 104 |
)
|
| 105 |
+
|
| 106 |
+
demo.load(update_placeholder_text, None, html_output)
|
| 107 |
|
| 108 |
# Launch the app
|
| 109 |
if __name__ == "__main__":
|