Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import json
|
2 |
import gradio as gr
|
3 |
import tempfile
|
|
|
4 |
|
5 |
def update_swagger(swagger_content):
|
6 |
try:
|
@@ -17,10 +18,10 @@ def update_swagger(swagger_content):
|
|
17 |
# Convert back to JSON string
|
18 |
updated_swagger = json.dumps(swagger_data, indent=2)
|
19 |
|
20 |
-
# Save to a temporary file for download
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
return updated_swagger, temp_file_path
|
26 |
except Exception as e:
|
|
|
1 |
import json
|
2 |
import gradio as gr
|
3 |
import tempfile
|
4 |
+
import os
|
5 |
|
6 |
def update_swagger(swagger_content):
|
7 |
try:
|
|
|
18 |
# Convert back to JSON string
|
19 |
updated_swagger = json.dumps(swagger_data, indent=2)
|
20 |
|
21 |
+
# Save to a named temporary file for download
|
22 |
+
temp_file_path = os.path.join(tempfile.gettempdir(), "updatedswagger.json")
|
23 |
+
with open(temp_file_path, "w", encoding="utf-8") as temp_file:
|
24 |
+
temp_file.write(updated_swagger)
|
25 |
|
26 |
return updated_swagger, temp_file_path
|
27 |
except Exception as e:
|