Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -160,12 +160,22 @@ with gr.Blocks(title="LightDiffusion Web UI") as demo:
|
|
160 |
outputs=gallery
|
161 |
)
|
162 |
|
|
|
|
|
|
|
163 |
# For local testing
|
164 |
if __name__ == "__main__":
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
outputs=gallery
|
161 |
)
|
162 |
|
163 |
+
def is_huggingface_space():
|
164 |
+
return "SPACE_ID" in os.environ
|
165 |
+
|
166 |
# For local testing
|
167 |
if __name__ == "__main__":
|
168 |
+
if is_huggingface_space():
|
169 |
+
demo.launch(
|
170 |
+
debug=False,
|
171 |
+
server_name="0.0.0.0",
|
172 |
+
server_port=7860 # Standard HF Spaces port
|
173 |
+
)
|
174 |
+
else:
|
175 |
+
demo.launch(
|
176 |
+
server_name="0.0.0.0",
|
177 |
+
server_port=8000,
|
178 |
+
auth=None,
|
179 |
+
share=True, # Only enable sharing locally
|
180 |
+
debug=True
|
181 |
+
)
|