Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,38 +64,13 @@ output_file = gr.File(label="Output PNG File")
|
|
64 |
chameleon = load_img("butterfly.jpg", output_type="pil")
|
65 |
url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
66 |
|
67 |
-
|
|
|
|
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
def login(username, password):
|
73 |
-
if verify_credentials(username, password):
|
74 |
-
return gr.update(visible=False), gr.update(visible=True), "๋ก๊ทธ์ธ ์ฑ๊ณต"
|
75 |
-
else:
|
76 |
-
return gr.update(visible=True), gr.update(visible=False), "์์ด๋ ๋๋ ๋น๋ฐ๋ฒํธ๊ฐ ํ๋ ธ์ต๋๋ค."
|
77 |
-
|
78 |
-
with gr.Blocks() as login_demo:
|
79 |
-
with gr.Row() as login_row:
|
80 |
-
username = gr.Textbox(label="์์ด๋")
|
81 |
-
password = gr.Textbox(label="๋น๋ฐ๋ฒํธ", type="password")
|
82 |
-
login_button = gr.Button("๋ก๊ทธ์ธ")
|
83 |
-
login_message = gr.Textbox(label="๋ฉ์์ง", interactive=False)
|
84 |
-
|
85 |
-
with gr.Row(visible=False) as main_app:
|
86 |
-
tab1 = gr.Interface(fn, inputs=image_upload, outputs=slider1, examples=[chameleon], api_name="image")
|
87 |
-
tab2 = gr.Interface(fn, inputs=url_input, outputs=slider2, examples=[url_example], api_name="text")
|
88 |
-
tab3 = gr.Interface(process_file, inputs=image_file_upload, outputs=output_file, examples=["butterfly.jpg"], api_name="png")
|
89 |
-
|
90 |
-
demo = gr.TabbedInterface(
|
91 |
-
[tab1, tab2, tab3], ["Image Upload", "URL Input", "File Output"], title="Background Removal Tool"
|
92 |
-
)
|
93 |
-
|
94 |
-
login_button.click(
|
95 |
-
login,
|
96 |
-
inputs=[username, password],
|
97 |
-
outputs=[login_row, main_app, login_message]
|
98 |
-
)
|
99 |
|
100 |
if __name__ == "__main__":
|
101 |
-
|
|
|
64 |
chameleon = load_img("butterfly.jpg", output_type="pil")
|
65 |
url_example = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
66 |
|
67 |
+
tab1 = gr.Interface(fn, inputs=image_upload, outputs=slider1, examples=[chameleon], api_name="image")
|
68 |
+
tab2 = gr.Interface(fn, inputs=url_input, outputs=slider2, examples=[url_example], api_name="text")
|
69 |
+
tab3 = gr.Interface(process_file, inputs=image_file_upload, outputs=output_file, examples=["butterfly.jpg"], api_name="png")
|
70 |
|
71 |
+
demo = gr.TabbedInterface(
|
72 |
+
[tab1, tab2, tab3], ["Image Upload", "URL Input", "File Output"], title="Background Removal Tool"
|
73 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
if __name__ == "__main__":
|
76 |
+
demo.launch(show_error=True)
|