Starting the interface
Launch the application
Run the application using the The interface will launch and be accessible in your web browser.
app.py entry point:Set API keys
The application requires API keys for Mistral and OpenAI. These can be set in two ways:
- Environment variables
- Hugging Face Spaces
Set the following environment variables before launching:The application automatically initializes with these keys on startup.
Interface features
Example queries
The interface provides pre-configured example queries you can test:Real-time progress tracking
The interface shows detailed progress through multiple stages:Getting responses
Fetching AI responses for each paraphrase with incremental progress (35-65% complete)The interface shows:
Getting responses (2/4)...Results display
After processing, the interface shows comprehensive results: Statistics panel- Hallucination detected: Yes/No
- Confidence score: 0.00-1.00
- Number of paraphrases analyzed
- Total processing time
- Red background with left border: Hallucination detected
- Green background with left border: No hallucination detected
- Original query and response
- All paraphrased queries and their responses
- Detailed reasoning from the judge model
- List of conflicting facts (if any)
Feedback system
Provide feedback on detection results to help improve the system:/data/feedback.db.
Feedback statistics
View aggregate statistics from all submitted feedback:- Total feedback submissions
- Number of hallucinations detected
- Number of clean responses
- Average confidence score
Customization
The interface is built with Gradio and includes extensive custom CSS for styling. You can modify the appearance by editing thecss variable in pas2.py:720-880.
Database persistence
The application uses SQLite for persistent storage:- Primary location:
/data/feedback.db(for Hugging Face Spaces persistent storage) - Fallback location:
temp_data/feedback.db(local development)
Logging
The interface provides detailed logging for troubleshooting:- API initialization status
- Paraphrase generation progress
- Response retrieval timing
- Judgment model execution
- Error messages and stack traces