banyapon commited on
Commit
918e1e1
·
1 Parent(s): fdd73d7

checkpoint 360 app

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  from PIL import Image
3
  from diffusers import StableDiffusionPipeline
@@ -8,7 +9,7 @@ from gradio_pannellum import Pannellum
8
  import io
9
  from huggingface_hub import snapshot_download
10
  from txt2panoimg import Text2360PanoramaImagePipeline
11
- import spaces
12
 
13
  # Download the model
14
  model_path = snapshot_download("archerfmy0831/sd-t2i-360panoimage")
@@ -28,15 +29,17 @@ def text_to_pano(prompt, upscale):
28
 
29
 
30
  title = """
31
- <div style="text-align: center;">
32
  <img src="https://ant.dpu.ac.th/wp-content/uploads/2024/04/dpulogo.png" width="200"/>
33
- <h1>SD-T2I-360PanoImage</h1>
34
- <p>360° Panorama Image Generation</p>
 
 
 
 
 
35
  </div>
36
- <p><center>
37
- <a href="https://github.com/ArcherFMY/SD-T2I-360PanoImage/" target="_blank">[Github]</a>
38
- <a href="https://huggingface.co/archerfmy0831/sd-t2i-360panoimage" target="_blank">[Models]</a>
39
- </center></p>
40
  """
41
 
42
  def create_aframe_html(image):
@@ -108,11 +111,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
108
  )
109
  t2p_image_output.change(create_aframe_preview, inputs=[t2p_image_output], outputs=[aframe_preview])
110
 
111
- copy_html_button.click(
112
- None,
113
- inputs=[output_html],
114
- outputs=[],
115
- _js="(html) => {navigator.clipboard.writeText(html).then(() => alert('Copied to clipboard!')).catch(err => console.error('Failed to copy: ', err));}"
116
- )
117
 
118
  demo.launch()
 
1
+ import spaces
2
  import gradio as gr
3
  from PIL import Image
4
  from diffusers import StableDiffusionPipeline
 
9
  import io
10
  from huggingface_hub import snapshot_download
11
  from txt2panoimg import Text2360PanoramaImagePipeline
12
+
13
 
14
  # Download the model
15
  model_path = snapshot_download("archerfmy0831/sd-t2i-360panoimage")
 
29
 
30
 
31
  title = """
32
+ <div style="text-align: left;">
33
  <img src="https://ant.dpu.ac.th/wp-content/uploads/2024/04/dpulogo.png" width="200"/>
34
+ <h4></h4>
35
+ <p>This Space is a playground designed to experiment with generating 360-degree images for use in Virtual Reality (VR) experiences. It utilizes A-Frame to render the images as WebXR using a Text-to-VR approach. This demonstration was presented at the MHESI Fair 2024 in Thailand. <br/> It is conducted by the College of Creative Design and Entertainment Technology, Dhurakij Pundit University, in the lab of Asst. Prof. Banyapon Poolsawas under the MIT License.</p>
36
+ <p>SD-T2I-360PanoImage Generate 360° Panorama Image Generation</p>
37
+ <p>
38
+ <a href="https://github.com/ArcherFMY/SD-T2I-360PanoImage/" target="_blank">[Github]</a>
39
+ <a href="https://huggingface.co/archerfmy0831/sd-t2i-360panoimage" target="_blank">[Models]</a>
40
+ </p>
41
  </div>
42
+
 
 
 
43
  """
44
 
45
  def create_aframe_html(image):
 
111
  )
112
  t2p_image_output.change(create_aframe_preview, inputs=[t2p_image_output], outputs=[aframe_preview])
113
 
114
+ copy_html_button.click(lambda html: gr.File.update(value=html, visible=True), inputs=[output_html], outputs=[gr.File(label="A-Frame HTML Code", visible=False)])
 
 
 
 
 
115
 
116
  demo.launch()