Spaces:
Sleeping
Sleeping
Dan Mo
commited on
Commit
·
4150a53
1
Parent(s):
e11fd2f
Update sharing logic in EmojiMashupApp to handle Hugging Face Spaces environment
Browse files
app.py
CHANGED
@@ -259,16 +259,20 @@ class EmojiMashupApp:
|
|
259 |
share: Whether to create a public sharing link
|
260 |
"""
|
261 |
logger.info("Starting Emoji Mashup App")
|
262 |
-
|
263 |
interface = self.create_interface()
|
264 |
# Check if running on Hugging Face Spaces
|
265 |
is_on_spaces = os.environ.get("SPACE_ID") is not None
|
266 |
|
267 |
-
#
|
268 |
-
if
|
269 |
-
share
|
270 |
-
|
271 |
-
|
|
|
|
|
|
|
|
|
272 |
|
273 |
|
274 |
# Main entry point
|
|
|
259 |
share: Whether to create a public sharing link
|
260 |
"""
|
261 |
logger.info("Starting Emoji Mashup App")
|
262 |
+
|
263 |
interface = self.create_interface()
|
264 |
# Check if running on Hugging Face Spaces
|
265 |
is_on_spaces = os.environ.get("SPACE_ID") is not None
|
266 |
|
267 |
+
# If on Spaces, never use share=True
|
268 |
+
if is_on_spaces:
|
269 |
+
# When on Spaces, don't use share parameter at all
|
270 |
+
interface.launch()
|
271 |
+
else:
|
272 |
+
# When running locally, default to share=True unless explicitly set
|
273 |
+
if share is None:
|
274 |
+
share = True
|
275 |
+
interface.launch(share=share)
|
276 |
|
277 |
|
278 |
# Main entry point
|