Commit
·
9989a83
1
Parent(s):
8b8d633
Refactor Gradio launch settings to streamline API endpoint configuration, removing unnecessary parameters for improved clarity and performance in both local and Spaces environments.
Browse files
app.py
CHANGED
@@ -265,18 +265,12 @@ with gr.Blocks(
|
|
265 |
cache_examples=False # Disable example caching
|
266 |
)
|
267 |
|
268 |
-
# Launch with Spaces-specific settings
|
269 |
if __name__ == "__main__":
|
270 |
import os
|
271 |
|
272 |
-
# Use standard Gradio launch with API enabled
|
273 |
demo.launch(
|
274 |
server_name="0.0.0.0",
|
275 |
server_port=7860,
|
276 |
show_error=True,
|
277 |
-
|
278 |
-
max_threads=1,
|
279 |
-
api_name="predict", # Enable API endpoint with name "predict"
|
280 |
-
share=False, # Don't use share on Spaces
|
281 |
-
prevent_thread_lock=True # Prevent thread lock issues
|
282 |
)
|
|
|
265 |
cache_examples=False # Disable example caching
|
266 |
)
|
267 |
|
|
|
268 |
if __name__ == "__main__":
|
269 |
import os
|
270 |
|
|
|
271 |
demo.launch(
|
272 |
server_name="0.0.0.0",
|
273 |
server_port=7860,
|
274 |
show_error=True,
|
275 |
+
api_name="predict"
|
|
|
|
|
|
|
|
|
276 |
)
|