Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import os
|
|
4 |
import base64
|
5 |
from PIL import Image
|
6 |
from io import BytesIO # Correctly import BytesIO from the io module
|
|
|
7 |
|
8 |
# Set page title and layout
|
9 |
st.set_page_config(page_title="Image Caption Generator", layout="centered")
|
@@ -79,6 +80,11 @@ if uploaded_image and API_KEY:
|
|
79 |
st.subheader("Generated Caption")
|
80 |
st.write(caption)
|
81 |
|
|
|
|
|
|
|
|
|
|
|
82 |
except Exception as e:
|
83 |
st.error(f"Error processing the response: {e}")
|
84 |
else:
|
|
|
4 |
import base64
|
5 |
from PIL import Image
|
6 |
from io import BytesIO # Correctly import BytesIO from the io module
|
7 |
+
import pyperclip # For copying text to clipboard
|
8 |
|
9 |
# Set page title and layout
|
10 |
st.set_page_config(page_title="Image Caption Generator", layout="centered")
|
|
|
80 |
st.subheader("Generated Caption")
|
81 |
st.write(caption)
|
82 |
|
83 |
+
# Add a copy button to copy the caption to clipboard
|
84 |
+
if st.button("Copy Caption"):
|
85 |
+
pyperclip.copy(caption) # Copy caption to clipboard
|
86 |
+
st.success("Caption copied to clipboard!")
|
87 |
+
|
88 |
except Exception as e:
|
89 |
st.error(f"Error processing the response: {e}")
|
90 |
else:
|