Update app.py
Browse files
app.py
CHANGED
@@ -1148,16 +1148,34 @@ This AI agent specializes in automated vulnerability research and analysis, buil
|
|
1148 |
)
|
1149 |
|
1150 |
|
1151 |
-
|
1152 |
-
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1148 |
)
|
1149 |
|
1150 |
|
1151 |
+
# Configure for Hugging Face Spaces compatibility
|
1152 |
+
is_spaces = os.getenv("SPACE_ID") is not None
|
1153 |
+
|
1154 |
+
if is_spaces:
|
1155 |
+
# Hugging Face Spaces configuration
|
1156 |
+
demo.launch(
|
1157 |
+
debug=False,
|
1158 |
+
server_name="0.0.0.0",
|
1159 |
+
server_port=int(os.getenv("PORT", 7860)),
|
1160 |
+
share=True,
|
1161 |
+
**kwargs
|
1162 |
+
)
|
1163 |
+
else:
|
1164 |
+
# Local development configuration
|
1165 |
+
demo.launch(
|
1166 |
+
debug=True,
|
1167 |
+
server_name="localhost",
|
1168 |
+
server_port=7860,
|
1169 |
+
share=False,
|
1170 |
+
**kwargs
|
1171 |
+
)
|
1172 |
+
|
1173 |
+
# Launch the application
|
1174 |
+
if __name__ == "__main__":
|
1175 |
+
try:
|
1176 |
+
GradioUI(file_upload_folder="uploads").launch()
|
1177 |
+
except KeyboardInterrupt:
|
1178 |
+
print("Application stopped by user")
|
1179 |
+
except Exception as e:
|
1180 |
+
print(f"Error starting application: {e}")
|
1181 |
+
raise
|