sariyam commited on
Commit
7b293a2
Β·
verified Β·
1 Parent(s): 49b93b2

save added to tab1

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -26,7 +26,13 @@ def fn(image):
26
  im = im.convert("RGB")
27
  origin = im.copy()
28
  processed_image = process(im)
29
- return (processed_image, origin)
 
 
 
 
 
 
30
 
31
  @spaces.GPU
32
  def process(image):
@@ -56,11 +62,12 @@ image_file_upload = gr.Image(label="Upload an image", type="filepath")
56
  url_input = gr.Textbox(label="Paste an image URL")
57
  output_file = gr.File(label="Output PNG File")
58
 
 
59
  # Example images
60
  chameleon = load_img("butterfly.jpg", output_type="pil")
61
  url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
62
 
63
- tab1 = gr.Interface(fn, inputs=image_upload, outputs=slider1, examples=[chameleon], api_name="image")
64
  tab2 = gr.Interface(fn, inputs=url_input, outputs=slider2, examples=[url_example], api_name="text")
65
  tab3 = gr.Interface(process_file, inputs=image_file_upload, outputs=output_file, examples=["butterfly.jpg"], api_name="png")
66
 
 
26
  im = im.convert("RGB")
27
  origin = im.copy()
28
  processed_image = process(im)
29
+
30
+ #vj
31
+ # Save the processed image as PNG
32
+ output_path = "processed_output.png"
33
+ processed_image.save(output_path, format="PNG")
34
+
35
+ return (processed_image, origin , output_path)
36
 
37
  @spaces.GPU
38
  def process(image):
 
62
  url_input = gr.Textbox(label="Paste an image URL")
63
  output_file = gr.File(label="Output PNG File")
64
 
65
+
66
  # Example images
67
  chameleon = load_img("butterfly.jpg", output_type="pil")
68
  url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
69
 
70
+ tab1 = gr.Interface(fn, inputs=image_upload, outputs=[slider1 , output_file], examples=[chameleon], api_name="image")
71
  tab2 = gr.Interface(fn, inputs=url_input, outputs=slider2, examples=[url_example], api_name="text")
72
  tab3 = gr.Interface(process_file, inputs=image_file_upload, outputs=output_file, examples=["butterfly.jpg"], api_name="png")
73