import React, { useState } from 'react'; import { improveClassification } from '../api/api'; import { ImprovementRequest, ImprovementResponse } from '../types/api'; const Improve: React.FC = () => { const [text, setText] = useState(''); const [categories, setCategories] = useState(''); const [validationReport, setValidationReport] = useState(''); const [improvementResult, setImprovementResult] = useState(null); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const handleImprove = async () => { if (!text || !categories || !validationReport) return; setLoading(true); setError(null); try { const request: ImprovementRequest = { df: { text: text.split('\n').filter(t => t.trim()) }, validation_report: validationReport, text_columns: ['text'], categories, classifier_type: 'gpt35', show_explanations: true, file_path: 'examples/emails.csv' }; const response = await improveClassification(request); setImprovementResult(response); } catch (err) { setError('Failed to improve classifications'); } finally { setLoading(false); } }; return (

Improve Classifications

Enter text samples and validation report to improve classifications.