Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,18 +12,27 @@ def url_shortener(url):
|
|
12 |
short_url = shorten_url(url)
|
13 |
return short_url
|
14 |
|
|
|
|
|
|
|
15 |
# Gradio 인터페이스 설정
|
16 |
with gr.Blocks() as iface:
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
def update_short_url(url):
|
23 |
short_url = url_shortener(url)
|
24 |
return short_url
|
25 |
|
26 |
shorten_button.click(fn=update_short_url, inputs=url_input, outputs=short_url_output)
|
|
|
27 |
|
28 |
copy_button.click(fn=None, _js="navigator.clipboard.writeText(document.querySelector('input[aria-label=\"Shortened URL\"]').value)")
|
29 |
|
|
|
12 |
short_url = shorten_url(url)
|
13 |
return short_url
|
14 |
|
15 |
+
def clear_inputs():
|
16 |
+
return "", ""
|
17 |
+
|
18 |
# Gradio 인터페이스 설정
|
19 |
with gr.Blocks() as iface:
|
20 |
+
with gr.Row():
|
21 |
+
with gr.Column():
|
22 |
+
url_input = gr.Textbox(label="Enter URL")
|
23 |
+
shorten_button = gr.Button("Shorten URL")
|
24 |
+
clear_button = gr.Button("Clear")
|
25 |
+
|
26 |
+
with gr.Column():
|
27 |
+
short_url_output = gr.Textbox(label="Shortened URL", copyable=True)
|
28 |
+
copy_button = gr.Button("Copy to Clipboard")
|
29 |
+
|
30 |
def update_short_url(url):
|
31 |
short_url = url_shortener(url)
|
32 |
return short_url
|
33 |
|
34 |
shorten_button.click(fn=update_short_url, inputs=url_input, outputs=short_url_output)
|
35 |
+
clear_button.click(fn=clear_inputs, inputs=[], outputs=[url_input, short_url_output])
|
36 |
|
37 |
copy_button.click(fn=None, _js="navigator.clipboard.writeText(document.querySelector('input[aria-label=\"Shortened URL\"]').value)")
|
38 |
|