Spaces:
Sleeping
Sleeping
| # app.py | |
| import gradio as gr | |
| from bot_detector import analyze_post | |
| with gr.Blocks(theme=gr.themes.Soft()) as demo: | |
| gr.Markdown("# 🕵️ Social Media Bot Detector") | |
| with gr.Row(): | |
| post_url = gr.Textbox(label="Post URL", placeholder="Enter Facebook/Instagram post URL") | |
| with gr.Column(): | |
| gr.Markdown("### OR") | |
| sample_btns = gr.Radio( | |
| ["Real Engagement Sample", "Bot Engagement Sample"], | |
| label="Try sample data" | |
| ) | |
| results = gr.JSON(label="Analysis Results") | |
| with gr.Row(): | |
| analyze_btn = gr.Button("Analyze Engagement", variant="primary") | |
| report_btn = gr.Button("Generate PDF Report") | |
| # Visualization section | |
| with gr.Tab("Visualizations"): | |
| gr.Markdown("## Engagement Patterns") | |
| timing_plot = gr.Plot() | |
| cluster_plot = gr.Plot() | |
| analyze_btn.click( | |
| analyze_post, | |
| inputs=[post_url, sample_btns], | |
| outputs=[results, timing_plot, cluster_plot] | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() |