thomasgauthier commited on
Commit
a5d57e1
1 Parent(s): 1d2fb58

add examples

Browse files
examples/in0.jpg ADDED
examples/in1.webp ADDED
examples/in2.jpg ADDED
examples/in3.jpg ADDED
examples/out0.webp ADDED
examples/out1.png ADDED
examples/out2.png ADDED
examples/out3.png ADDED
gradio_interface.py CHANGED
@@ -1,6 +1,12 @@
1
  import gradio as gr
2
  from PIL import Image
3
 
 
 
 
 
 
 
4
 
5
  def create_gradio_interface(process_and_generate):
6
  def gradio_process_and_generate(input_image, prompt, num_images, cfg_weight):
@@ -15,6 +21,7 @@ Here, by feeding the model an image and then asking it to generate that same ima
15
  with gr.Blocks() as demo:
16
  gr.Markdown("# How Janus-1.3B sees itself")
17
 
 
18
  with gr.Row():
19
  input_image = gr.Image(type="filepath", label="Input Image")
20
  output_images = gr.Gallery(label="Generated Images", columns=2, rows=2)
@@ -28,6 +35,11 @@ Here, by feeding the model an image and then asking it to generate that same ima
28
  inputs=[input_image, prompt, num_images, cfg_weight],
29
  outputs=output_images
30
  )
 
 
 
 
 
31
  gr.Markdown(explanation)
32
 
33
  return demo
 
1
  import gradio as gr
2
  from PIL import Image
3
 
4
+ examples = [
5
+ [Image.open("examples/in0.jpg"), Image.open("examples/out0.webp")],
6
+ [Image.open("examples/in1.webp"), Image.open("examples/out1.png")],
7
+ [Image.open("examples/in2.jpg"), Image.open("examples/out2.png")],
8
+ [Image.open("examples/in3.jpg"), Image.open("examples/out3.png")],
9
+ ]
10
 
11
  def create_gradio_interface(process_and_generate):
12
  def gradio_process_and_generate(input_image, prompt, num_images, cfg_weight):
 
21
  with gr.Blocks() as demo:
22
  gr.Markdown("# How Janus-1.3B sees itself")
23
 
24
+ dummy = gr.Image(type="filepath", label="Generated Image", visible=False)
25
  with gr.Row():
26
  input_image = gr.Image(type="filepath", label="Input Image")
27
  output_images = gr.Gallery(label="Generated Images", columns=2, rows=2)
 
35
  inputs=[input_image, prompt, num_images, cfg_weight],
36
  outputs=output_images
37
  )
38
+ gr.Examples(
39
+ examples=examples,
40
+ inputs=[input_image, dummy]
41
+ )
42
+
43
  gr.Markdown(explanation)
44
 
45
  return demo