Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,15 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import torch
|
| 3 |
import requests
|
| 4 |
import json
|
| 5 |
-
# from diffusers import StableDiffusionLDM3DPipeline
|
| 6 |
import gradio as gr
|
| 7 |
import torch
|
| 8 |
from PIL import Image
|
| 9 |
-
import base64
|
| 10 |
-
from io import BytesIO
|
| 11 |
-
from tempfile import NamedTemporaryFile
|
| 12 |
-
from pathlib import Path
|
| 13 |
|
| 14 |
from gradio_client import Client
|
| 15 |
|
|
@@ -59,7 +53,7 @@ html_title = '''
|
|
| 59 |
|
| 60 |
client = Client("http://198.175.88.247:17810/")
|
| 61 |
|
| 62 |
-
def
|
| 63 |
|
| 64 |
if viewer_mode == "6DOF":
|
| 65 |
return f"""<iframe src="file=static/three6dof.html" width="100%" height="500px" data-rgb="{rgb_path}" data-depth="{depth_path}"></iframe>"""
|
|
@@ -74,7 +68,7 @@ def generate(
|
|
| 74 |
randomize_seed: bool = True,
|
| 75 |
):
|
| 76 |
|
| 77 |
-
|
| 78 |
prompt, # str in 'Prompt' Textbox component
|
| 79 |
negative_prompt, # str in 'Negative Prompt' Textbox component
|
| 80 |
guidance_scale, # int | float (numeric value between 0 and 10) in 'Guidance Scale' Slider component
|
|
@@ -84,9 +78,9 @@ def generate(
|
|
| 84 |
fn_index=1
|
| 85 |
)
|
| 86 |
|
| 87 |
-
|
| 88 |
|
| 89 |
-
return
|
| 90 |
|
| 91 |
with gr.Blocks(theme=theme, css=css) as demo:
|
| 92 |
gr.HTML(value=html_title)
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import requests
|
| 3 |
import json
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import torch
|
| 6 |
from PIL import Image
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
from gradio_client import Client
|
| 9 |
|
|
|
|
| 53 |
|
| 54 |
client = Client("http://198.175.88.247:17810/")
|
| 55 |
|
| 56 |
+
def build_iframe(rgb_path: str, depth_path: str, viewer_mode: str = "6DOF"):
|
| 57 |
|
| 58 |
if viewer_mode == "6DOF":
|
| 59 |
return f"""<iframe src="file=static/three6dof.html" width="100%" height="500px" data-rgb="{rgb_path}" data-depth="{depth_path}"></iframe>"""
|
|
|
|
| 68 |
randomize_seed: bool = True,
|
| 69 |
):
|
| 70 |
|
| 71 |
+
rgb_url, depth_url, generated_seed, _ = client.predict(
|
| 72 |
prompt, # str in 'Prompt' Textbox component
|
| 73 |
negative_prompt, # str in 'Negative Prompt' Textbox component
|
| 74 |
guidance_scale, # int | float (numeric value between 0 and 10) in 'Guidance Scale' Slider component
|
|
|
|
| 78 |
fn_index=1
|
| 79 |
)
|
| 80 |
|
| 81 |
+
iframe = build_iframe(rgb_url, depth_url)
|
| 82 |
|
| 83 |
+
return rgb, depth, generated_seed, iframe
|
| 84 |
|
| 85 |
with gr.Blocks(theme=theme, css=css) as demo:
|
| 86 |
gr.HTML(value=html_title)
|