Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from src.evaluator import website_analyzer, pdf_analyzer | |
| with gr.Blocks(theme=gr.themes.Soft(), css="style.css") as demo: | |
| with gr.Tab("Website Analyzer"): | |
| with gr.Row(): | |
| with gr.Column(): | |
| website_input = gr.Textbox(label="Website URL") | |
| with gr.Column(): | |
| website_output = gr.Image(label="Safety Score") | |
| analyze_website_btn = gr.Button("Analyze Website") | |
| analyze_website_btn.click( | |
| fn=website_analyzer, | |
| inputs=website_input, | |
| outputs=website_output, | |
| ) | |
| examples = ["https://www.nytimes.com/", "https://www.bbc.com/news", "https://www.theguardian.com/international", "https://www.reuters.com", "https://www.aljazeera.com"] | |
| gr.Examples( | |
| examples=examples, | |
| inputs=website_input, | |
| ) | |
| with gr.Tab("Document Analyzer"): | |
| with gr.Row(): | |
| with gr.Column(): | |
| document_input = gr.File(label="Upload PDF Document", file_types=[".pdf"]) | |
| with gr.Column(): | |
| document_output = gr.Image(label="Safety Score") | |
| analyze_document_btn = gr.Button("Analyze Document") | |
| analyze_document_btn.click( | |
| fn=pdf_analyzer, | |
| inputs=document_input, | |
| outputs=document_output, | |
| ) | |
| if __name__ == "__main__": | |
| demo.queue(max_size=10).launch(debug=True) | |