| | import gradio as gr |
| | from filter_agent import filter_math_query |
| | from wiki_scraper import get_wikipedia_article |
| |
|
| | def math_explainer(topic): |
| | """First checks if the topic is mathematical, corrects spelling, then fetches the full Wikipedia article and summarizes it.""" |
| |
|
| | |
| | filter_result, corrected_topic = filter_math_query(topic) |
| |
|
| | if "β" in filter_result: |
| | return filter_result |
| |
|
| | |
| | return get_wikipedia_article(corrected_topic) |
| |
|
| | iface = gr.Interface( |
| | fn=math_explainer, |
| | inputs="text", |
| | outputs="text", |
| | title="Math Research AI", |
| | description="π Math Research AI makes learning mathematics easier by making key concepts accessible to everyone through clear and simplified explanations.\n\nThis math-specialized AI agent analyzes your query, automatically corrects spelling errors, retrieves a Wikipedia article, and generates a simplified and understandable summary." |
| | ) |
| |
|
| | if __name__ == "__main__": |
| | iface.launch() |
| |
|