File size: 976 Bytes
53e0bdc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
from dotenv import load_dotenv
from code_analyzer.analysis import code_analysis_report
from code_analyzer.scoring import code_analysis_score
load_dotenv()
# Create Gradio interfaces for code analysis
analysis_report_demo = gr.Interface(
fn=code_analysis_report,
inputs=gr.Textbox(label="Enter Code Here", lines=20),
outputs=gr.Textbox(label="Analysis Report", lines=20),
description="Generate a basic code analysis report.",
)
code_score_demo = gr.Interface(
fn=code_analysis_score,
inputs=gr.Textbox(label="Enter Code Here", lines=20),
outputs=gr.JSON(label="Code Score"),
description="Generate a basic code score.",
)
# Create tabbed interface
demo = gr.TabbedInterface(
[analysis_report_demo, code_score_demo],
["Code Analysis Report", "Code Score"],
title="Code Analysis Server",
)
if __name__ == "__main__":
# Launch the Gradio interface
demo.launch(share=False, mcp_server=True, debug=True)
|