mrbeliever commited on
Commit
1492b86
·
verified ·
1 Parent(s): bc04ce4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -20
app.py CHANGED
@@ -11,12 +11,6 @@ st.set_page_config(page_title="Image Caption Generator", layout="centered")
11
  # API key from environment variable
12
  API_KEY = os.environ.get("NEBIUS_API_KEY")
13
 
14
- # UI for the app
15
- st.title("Image Caption Generator")
16
- st.write(
17
- "Upload an image, and this app will generate a detailed caption for it using the Nebius AI API."
18
- )
19
-
20
  if not API_KEY:
21
  st.error("API key not found. Please set the `NEBIUS_API_KEY` environment variable.")
22
 
@@ -85,20 +79,6 @@ if uploaded_image and API_KEY:
85
  st.subheader("Generated Caption")
86
  st.write(caption)
87
 
88
- # Add a copy button for the caption using JavaScript
89
- st.markdown(
90
- f"""
91
- <button id="copy-button" onclick="navigator.clipboard.writeText('{caption}')">Copy Caption</button>
92
- <script>
93
- const copyButton = document.getElementById('copy-button');
94
- copyButton.addEventListener('click', function() {{
95
- copyButton.innerText = 'Copied!';
96
- }});
97
- </script>
98
- """,
99
- unsafe_allow_html=True,
100
- )
101
-
102
  except Exception as e:
103
  st.error(f"Error processing the response: {e}")
104
  else:
@@ -116,6 +96,7 @@ st.markdown(
116
  .css-1y4ccs5 {margin: 0 auto;}
117
  .css-1aumxhk {display: flex; justify-content: center;}
118
  .css-1k6kn8p {justify-content: center; align-items: center; display: flex;}
 
119
  </style>
120
  """, unsafe_allow_html=True
121
  )
 
11
  # API key from environment variable
12
  API_KEY = os.environ.get("NEBIUS_API_KEY")
13
 
 
 
 
 
 
 
14
  if not API_KEY:
15
  st.error("API key not found. Please set the `NEBIUS_API_KEY` environment variable.")
16
 
 
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:
 
96
  .css-1y4ccs5 {margin: 0 auto;}
97
  .css-1aumxhk {display: flex; justify-content: center;}
98
  .css-1k6kn8p {justify-content: center; align-items: center; display: flex;}
99
+ .css-ffhzg6 {text-align: center;}
100
  </style>
101
  """, unsafe_allow_html=True
102
  )