Spaces:
Running
Running
Deniel Dimitrov
commited on
Commit
·
f526d35
1
Parent(s):
202b173
Update app.py
Browse files
app.py
CHANGED
@@ -41,15 +41,9 @@ iface = gr.Interface(
|
|
41 |
fn=convert_to_ascii, # Function to run
|
42 |
inputs=["image","number"], # Input component (in this case, an image)
|
43 |
outputs="text", # Output component (in this case, text)
|
44 |
-
title="image-to-ascii (by peasoup)"
|
|
|
45 |
)
|
46 |
|
47 |
-
# Function to generate HTML code for the output text with a copy button
|
48 |
-
def copy_button(output_text):
|
49 |
-
return f"{output_text}<br><br><button onclick=\"navigator.clipboard.writeText('{output_text}').then(() => {{alert('Text copied to clipboard')}})\">Copy to Clipboard</button>"
|
50 |
-
|
51 |
-
# Set custom post-processing for the output text
|
52 |
-
iface.test_command = lambda output_text: copy_button(output_text)
|
53 |
-
|
54 |
# Launch the interface
|
55 |
iface.launch()
|
|
|
41 |
fn=convert_to_ascii, # Function to run
|
42 |
inputs=["image","number"], # Input component (in this case, an image)
|
43 |
outputs="text", # Output component (in this case, text)
|
44 |
+
title="image-to-ascii (by peasoup)",
|
45 |
+
show_copy_button=True,
|
46 |
)
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
# Launch the interface
|
49 |
iface.launch()
|