Spaces:
Running
Running
Simplify launch configuration for HuggingFace Spaces
Browse files- Remove complex launch parameters that cause compatibility issues
- Use default Gradio launch() settings which work best with Spaces
- Pin Gradio version to 4.44.1 for stability
- app.py +2 -43
- requirements.txt +1 -1
app.py
CHANGED
@@ -1960,46 +1960,5 @@ with gr.Blocks(
|
|
1960 |
)
|
1961 |
|
1962 |
if __name__ == "__main__":
|
1963 |
-
#
|
1964 |
-
|
1965 |
-
"server_name": "127.0.0.1", # Use localhost instead of 0.0.0.0
|
1966 |
-
"server_port": 7860,
|
1967 |
-
"share": False, # Disable sharing to avoid origin issues
|
1968 |
-
"debug": False, # Disable debug mode to reduce console errors
|
1969 |
-
"show_error": True, # Show errors in interface
|
1970 |
-
"quiet": False, # Keep logging for debugging
|
1971 |
-
"favicon_path": None, # Disable favicon to avoid 404s
|
1972 |
-
"ssl_verify": False, # Disable SSL verification for local development
|
1973 |
-
"allowed_paths": [], # Empty allowed paths
|
1974 |
-
"blocked_paths": [], # Empty blocked paths
|
1975 |
-
"root_path": None, # No root path
|
1976 |
-
"app_kwargs": {
|
1977 |
-
"docs_url": None, # Disable docs endpoint
|
1978 |
-
"redoc_url": None, # Disable redoc endpoint
|
1979 |
-
}
|
1980 |
-
}
|
1981 |
-
|
1982 |
-
# Override settings for specific environments
|
1983 |
-
if os.environ.get('SPACE_ID') or os.environ.get('SPACE_HOST'):
|
1984 |
-
# HuggingFace Spaces environment
|
1985 |
-
launch_kwargs.update({
|
1986 |
-
"server_name": "0.0.0.0",
|
1987 |
-
"server_port": 7860,
|
1988 |
-
"share": False
|
1989 |
-
})
|
1990 |
-
elif os.environ.get('CODESPACES'):
|
1991 |
-
launch_kwargs.update({
|
1992 |
-
"server_name": "0.0.0.0",
|
1993 |
-
"share": True
|
1994 |
-
})
|
1995 |
-
elif 'devtunnels.ms' in os.environ.get('GRADIO_SERVER_NAME', ''):
|
1996 |
-
launch_kwargs.update({
|
1997 |
-
"server_name": "0.0.0.0",
|
1998 |
-
"share": True
|
1999 |
-
})
|
2000 |
-
|
2001 |
-
print("π Starting Chat UI Helper...")
|
2002 |
-
print(f"π Server: {launch_kwargs['server_name']}:{launch_kwargs['server_port']}")
|
2003 |
-
print(f"π Share: {launch_kwargs['share']}")
|
2004 |
-
|
2005 |
-
demo.launch(**launch_kwargs)
|
|
|
1960 |
)
|
1961 |
|
1962 |
if __name__ == "__main__":
|
1963 |
+
# Use default Gradio launch settings for HuggingFace Spaces compatibility
|
1964 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
gradio
|
2 |
requests>=2.32.3
|
3 |
beautifulsoup4>=4.12.3
|
4 |
python-dotenv>=1.0.0
|
|
|
1 |
+
gradio==4.44.1
|
2 |
requests>=2.32.3
|
3 |
beautifulsoup4>=4.12.3
|
4 |
python-dotenv>=1.0.0
|