|
import json |
|
import gradio as gr |
|
|
|
def update_swagger(swagger_content): |
|
try: |
|
|
|
swagger_data = json.loads(swagger_content) |
|
|
|
|
|
swagger_data['info'] = { |
|
"title": "My API", |
|
"version": "1.0.0", |
|
"description": "Your API description" |
|
} |
|
|
|
|
|
updated_swagger = json.dumps(swagger_data, indent=2) |
|
return updated_swagger |
|
except Exception as e: |
|
return f"Error updating swagger.json: {e}" |
|
|
|
demo = gr.Interface( |
|
fn=update_swagger, |
|
inputs=gr.Textbox(lines=20, label="Input Swagger JSON"), |
|
outputs=gr.Textbox(lines=20, label="Updated Swagger JSON") |
|
) |
|
|
|
demo.launch() |
|
|