zay12121's picture
Update README.md
3140d61 verified

A newer version of the Streamlit SDK is available: 1.56.0

Upgrade
metadata
title: Free AI Detector (Public Models)
emoji: πŸ€–
colorFrom: blue
colorTo: purple
sdk: streamlit
sdk_version: 1.36.0
app_file: app.py
pinned: false

Free AI Detector (Public Models) πŸ€–

Analyze text to determine the likelihood of it being AI-generated or human-written using publicly available models.

This Streamlit application provides a user-friendly interface to detect AI-generated content using a combination of classification-based and perplexity-based models from the Hugging Face Transformers library.


✨ Features

  • Enhanced Classification-Based Detection: Utilizes advanced, fine-tuned models like SuperAnnotate/ai-detector which are trained on diverse AI-generated content from various LLMs (GPT, LLaMA, Anthropic, Mistral) and adversarial attacks for potentially higher accuracy.
  • Perplexity Analysis: Employs causal language models (e.g., GPT-2) to calculate the perplexity of the input text, offering an additional insight into its predictability (lower perplexity often indicates AI generation).
  • Multiple Model Choices: Select from various public models for both classification and perplexity analysis in the sidebar.
  • Clear & Intuitive UI: Built with Streamlit for a simple, interactive web interface, featuring a modern design with custom fonts, rounded corners, and a consistent color scheme.
  • Real-time Results: Get instant feedback on your text analysis with visual progress bars.

πŸš€ How to Use

  1. Paste your text: Enter the text you want to analyze into the provided text area.
  2. Select Models (Optional): Choose your preferred classification and perplexity models from the sidebar. The "SuperAnnotate AI Detector" is recommended for its enhanced accuracy.
  3. Click "Detect AI": The application will process your text and display the results, including AI/Human probabilities and a perplexity score.

πŸ’‘ How It Works

This tool leverages the power of Hugging Face Transformers to implement two primary AI content detection methods:

  1. Classification-based Models: These models are specifically trained on datasets containing both human-written and AI-generated text. They learn to identify subtle patterns and stylistic differences, outputting a probability score indicating the likelihood of the text being AI or human. The SuperAnnotate/ai-detector model, for instance, is trained on a diverse range of AI-generated content, making it potentially more effective against newer LLMs.

    • Interpretation: A higher AI probability suggests the text aligns more with patterns found in AI-generated content.
  2. Perplexity-based Analysis: Perplexity measures how "surprised" a language model is by a given sequence of words.

    • Lower perplexity means the model finds the text highly predictable. AI models tend to generate highly probable word sequences, leading to lower perplexity.
    • Higher perplexity indicates more unexpected or diverse word choices, which is characteristic of human writing.
    • Note: Perplexity is a relative metric; there isn't a universal "AI threshold." It's best used as a supporting indicator.

⚠️ Important Considerations

  • No Detector is 100% Accurate: AI detection is an evolving field, and models are constantly improving. This tool provides indicators, not definitive proof.
  • Short Texts: Very short inputs are generally harder for models to analyze reliably.
  • Newer AI Models: Text generated by very recent and advanced AI models may be more challenging for existing detectors to identify.
  • Model Variability: Different models may produce varying results. It's best to use them as a probabilistic assessment.

βš™οΈ Installation (for Local Development)

To run this application locally, follow these steps:

  1. Clone the repository:
    git clone [https://github.com/your-username/your-repo-name.git](https://github.com/your-username/your-repo-name.git) # Replace with your actual repo URL
    cd your-repo-name
    
  2. Create a virtual environment (recommended):
    python -m venv venv
    # On Windows:
    .\venv\Scripts\activate
    # On macOS/Linux:
    source venv/bin/activate
    
  3. Install dependencies:
    pip install -r requirements.txt
    
    (Refer to requirements.txt for specific versions, especially for torch if you need CUDA support.)
  4. Run the Streamlit app:
    streamlit run app.py
    

🀝 Contributing

Contributions are welcome! If you have suggestions for improvements, new features, or bug fixes, please feel free to:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Make your changes.
  4. Commit your changes (git commit -m 'Add new feature').
  5. Push to the branch (git push origin feature/your-feature-name).
  6. Open a Pull Request.

License

This project is open-source and available under the MIT License. (Assuming MIT, replace if different)