Dan Mo commited on
Commit
4150a53
·
1 Parent(s): e11fd2f

Update sharing logic in EmojiMashupApp to handle Hugging Face Spaces environment

Browse files
Files changed (1) hide show
  1. app.py +10 -6
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
- # Only set share=True if not on Spaces and share parameter is not explicitly set to False
268
- if share is None:
269
- share = not is_on_spaces
270
-
271
- interface.launch(share=share)
 
 
 
 
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