Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client, handle_file
|
3 |
from PIL import Image
|
4 |
-
import requests
|
5 |
import tempfile
|
6 |
import os
|
7 |
|
@@ -51,8 +50,8 @@ chameleon = "butterfly.jpg"
|
|
51 |
url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
52 |
|
53 |
# Tab 1: Image Upload
|
54 |
-
slider1_processed =
|
55 |
-
slider1_origin =
|
56 |
image_upload = gr.Image(label="Upload an image")
|
57 |
tab1 = gr.Interface(
|
58 |
fn=process_image_via_api,
|
@@ -63,8 +62,8 @@ tab1 = gr.Interface(
|
|
63 |
)
|
64 |
|
65 |
# Tab 2: URL Input
|
66 |
-
slider2_processed =
|
67 |
-
slider2_origin =
|
68 |
url_input = gr.Textbox(label="Paste an image URL")
|
69 |
tab2 = gr.Interface(
|
70 |
fn=process_url_via_api,
|
@@ -81,7 +80,7 @@ tab3 = gr.Interface(
|
|
81 |
fn=process_file_via_api,
|
82 |
inputs=image_file_upload,
|
83 |
outputs=output_file,
|
84 |
-
examples=[
|
85 |
api_name="/png_api"
|
86 |
)
|
87 |
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client, handle_file
|
3 |
from PIL import Image
|
|
|
4 |
import tempfile
|
5 |
import os
|
6 |
|
|
|
50 |
url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
51 |
|
52 |
# Tab 1: Image Upload
|
53 |
+
slider1_processed = gr.Image(label="Processed Image", type="pil")
|
54 |
+
slider1_origin = gr.Image(label="Original Image", type="pil")
|
55 |
image_upload = gr.Image(label="Upload an image")
|
56 |
tab1 = gr.Interface(
|
57 |
fn=process_image_via_api,
|
|
|
62 |
)
|
63 |
|
64 |
# Tab 2: URL Input
|
65 |
+
slider2_processed = gr.Image(label="Processed Image", type="pil")
|
66 |
+
slider2_origin = gr.Image(label="Original Image", type="pil")
|
67 |
url_input = gr.Textbox(label="Paste an image URL")
|
68 |
tab2 = gr.Interface(
|
69 |
fn=process_url_via_api,
|
|
|
80 |
fn=process_file_via_api,
|
81 |
inputs=image_file_upload,
|
82 |
outputs=output_file,
|
83 |
+
examples=[chameleon],
|
84 |
api_name="/png_api"
|
85 |
)
|
86 |
|