Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,12 +25,31 @@ with gr.Blocks() as demo:
|
|
| 25 |
with gr.Row():
|
| 26 |
roop_button = gr.Button("Try ROOP Deepfake")
|
| 27 |
text_to_image_button = gr.Button("Try Text to Image")
|
| 28 |
-
vr_button = gr.Button("AI for VR 101
|
| 29 |
cloth_button = gr.Button("Try Cloth Segmentation Inpainting")
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
demo.launch()
|
|
|
|
| 25 |
with gr.Row():
|
| 26 |
roop_button = gr.Button("Try ROOP Deepfake")
|
| 27 |
text_to_image_button = gr.Button("Try Text to Image")
|
| 28 |
+
vr_button = gr.Button("Try AI for VR 101 Research")
|
| 29 |
cloth_button = gr.Button("Try Cloth Segmentation Inpainting")
|
| 30 |
+
|
| 31 |
+
# Hidden Textbox to store the URL
|
| 32 |
+
url_textbox = gr.Textbox(visible=False)
|
| 33 |
+
|
| 34 |
+
# Set of URLs you want to redirect to
|
| 35 |
+
urls = {
|
| 36 |
+
"roop_button": "https://huggingface.co/spaces/banyapon/roop",
|
| 37 |
+
"text_to_image_button": "https://huggingface.co/spaces/banyapon/Realistic-Image-Generator-Model",
|
| 38 |
+
"vr_button": "https://huggingface.co/spaces/banyapon/Pana360gen",
|
| 39 |
+
"cloth_button": "https://huggingface.co/spaces/banyapon/InpaintCloth"
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
# Function to redirect the URL
|
| 43 |
+
def redirect(button_name):
|
| 44 |
+
return gr.update(value=urls[button_name])
|
| 45 |
+
|
| 46 |
+
# Function to perform the redirection
|
| 47 |
+
js_redirect = "(url) => {window.location.href = url; return []}"
|
| 48 |
+
|
| 49 |
+
# Add on_click events to the buttons
|
| 50 |
+
roop_button.click(redirect, inputs=[gr.Textbox(value="roop_button", visible=False)], outputs=[url_textbox], _js=js_redirect)
|
| 51 |
+
text_to_image_button.click(redirect, inputs=[gr.Textbox(value="text_to_image_button", visible=False)], outputs=[url_textbox], _js=js_redirect)
|
| 52 |
+
vr_button.click(redirect, inputs=[gr.Textbox(value="vr_button", visible=False)], outputs=[url_textbox], _js=js_redirect)
|
| 53 |
+
cloth_button.click(redirect, inputs=[gr.Textbox(value="cloth_button", visible=False)], outputs=[url_textbox], _js=js_redirect)
|
| 54 |
|
| 55 |
demo.launch()
|