lightmate commited on
Commit
031d3f6
Β·
verified Β·
1 Parent(s): dd8c8ac

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +88 -101
README.md CHANGED
@@ -1,127 +1,114 @@
1
- # DGaze - News Verification Gradio Frontend
2
-
3
- A modular Gradio-based frontend for the DGaze news verification system, designed to mirror the functionality of the React frontend while providing a simple, accessible interface.
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  ## Features
6
 
7
- - **News Verification**: Verify news articles and claims using advanced AI
8
- - **Modular Architecture**: Clean, maintainable code structure similar to the React frontend
9
- - **Rich Results Display**: Comprehensive verification results with confidence scores, evidence, and sources
10
- - **Responsive Design**: Clean, modern UI with proper styling and theming
11
- - **Collapsible Claims**: Interactive claim cards with show/hide evidence functionality
12
-
13
- ## Architecture
14
-
15
- The application follows a modular structure similar to the React frontend:
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- ```
18
- frontend_gradio/
19
- β”œβ”€β”€ config/ # Configuration management
20
- β”œβ”€β”€ api/ # Backend API client
21
- β”œβ”€β”€ components/ # UI formatting components
22
- β”œβ”€β”€ utils/ # Utility functions
23
- β”œβ”€β”€ app.py # Main application
24
- └── .env # Environment variables (not in repo)
25
- ```
26
-
27
- ## Setup Instructions
28
 
29
- ### 1. Environment Setup
30
 
31
- **IMPORTANT**: The backend URL is kept secret and must be configured via environment variables.
32
 
33
- 1. Copy the example environment file:
34
  ```bash
35
- cp .env.example .env
36
- ```
37
 
38
- 2. Edit `.env` file and add your backend URL:
39
- ```bash
40
- # REQUIRED: Add your actual backend URL here
41
- API_BASE_URL=https://your-actual-backend-url.com
 
42
 
43
- # Optional: Configure other settings as needed
 
 
 
 
44
  GRADIO_SERVER_PORT=7860
45
- GRADIO_SHARE=false
46
  DEBUG=false
47
  ```
48
 
49
- ⚠️ **Security Note**: Never commit the `.env` file to version control. It contains sensitive URLs and credentials.
50
-
51
- ### 2. Installation
52
-
53
- 1. Create and activate virtual environment:
54
- ```bash
55
- python -m venv venv
56
- source venv/bin/activate # On Windows: venv\Scripts\activate
57
- ```
58
-
59
- 2. Install dependencies:
60
- ```bash
61
- pip install -r requirements.txt
62
- ```
63
-
64
- ### 3. Running the Application
65
-
66
- ```bash
67
- python app.py
68
- ```
69
-
70
- The application will start on `http://localhost:7860` (or the port specified in your `.env` file).
71
-
72
- ## Configuration
73
-
74
- All configuration is managed through environment variables in the `.env` file:
75
-
76
- - **API_BASE_URL** (REQUIRED): Backend API URL
77
- - **GRADIO_SERVER_NAME**: Server hostname (default: 0.0.0.0)
78
- - **GRADIO_SERVER_PORT**: Server port (default: 7860)
79
- - **GRADIO_SHARE**: Enable Gradio sharing (default: false)
80
- - **DEBUG**: Enable debug mode (default: false)
81
-
82
- See `.env.example` for a complete list of available configuration options.
83
 
84
- ## Error Handling
85
 
86
- If the `API_BASE_URL` is not set in the `.env` file, the application will exit with a clear error message:
 
 
87
 
88
- ```
89
- ERROR: Required environment variable 'API_BASE_URL' not found in .env file!
90
- Please add 'API_BASE_URL=<your-backend-url>' to your .env file
91
- ```
92
-
93
- ## Security
94
 
95
- - Backend URLs are never hardcoded in the source code
96
- - All sensitive configuration is managed through environment variables
97
- - The `.env` file is excluded from version control via `.gitignore`
98
- - Use `.env.example` as a template for required variables
 
 
99
 
100
- ## Development
101
 
102
- The modular structure makes it easy to:
103
- - Add new UI components in `components/`
104
- - Extend API functionality in `api/`
105
- - Add utility functions in `utils/`
106
- - Modify configuration in `config/`
107
 
108
- ## Deployment
109
 
110
- For production deployment:
 
 
 
 
 
111
 
112
- 1. Set up your production `.env` file with actual values
113
- 2. Configure proper security settings
114
- 3. Use a production WSGI server instead of the development server
115
- 4. Set `DEBUG=false` in your environment
116
 
117
- ## Troubleshooting
 
 
 
 
118
 
119
- **Backend Connection Issues:**
120
- - Ensure your `API_BASE_URL` in `.env` is correct
121
- - Check if the backend service is running
122
- - Verify network connectivity to the backend
123
 
124
- **Environment Variable Issues:**
125
- - Make sure `.env` file exists in the project root
126
- - Verify all required variables are set
127
- - Check for typos in variable names
 
1
+ ---
2
+ title: DGaze News Verification
3
+ emoji: πŸ”
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: "4.0.0"
8
+ app_file: spaces_app.py
9
+ pinned: false
10
+ license: mit
11
+ short_description: AI-powered news verification system with free demo
12
+ ---
13
+
14
+ # DGaze - Advanced News Verification System
15
+
16
+ An advanced AI-powered news verification system with authentication that helps identify potentially misleading or false information.
17
 
18
  ## Features
19
 
20
+ - **πŸ” Authentication**: Secure Auth0 integration with trial and full access modes
21
+ - **πŸ†“ Free Trial**: 2 free verifications for unauthenticated users
22
+ - **πŸ” Real-time Analysis**: Instant verification of news articles and URLs
23
+ - **πŸ“Š Credibility Scoring**: Detailed credibility scores for news content
24
+ - **🌐 Source Verification**: Check the reliability of news sources
25
+ - **πŸ“± Multiple Interfaces**: Trial, login, and authenticated user interfaces
26
+ - **🎨 Beautiful UI**: Professional gradient design with responsive layout
27
+
28
+ ## How to Use
29
+
30
+ ### Free Trial (No Login Required)
31
+ 1. Visit the **trial interface** at `/trial`
32
+ 2. **Paste news text** or **URL** in the input box
33
+ 3. **Click "Verify News"** to analyze the content
34
+ 4. **Get detailed results** including credibility score and analysis
35
+ 5. Enjoy **2 free verifications** per session
36
+
37
+ ### Full Access (With Login)
38
+ 1. **Click "Sign In"** to authenticate via Auth0
39
+ 2. Get **unlimited verifications**
40
+ 3. Access to **premium features**
41
+ 4. **Session persistence** across visits
42
 
43
+ ## Configuration
 
 
 
 
 
 
 
 
 
 
44
 
45
+ This Space requires the following environment variables to be set in the Space settings:
46
 
47
+ ### Required Environment Variables
48
 
 
49
  ```bash
50
+ # Backend API Configuration (REQUIRED)
51
+ API_BASE_URL=your-backend-api-url
52
 
53
+ # Auth0 Configuration (REQUIRED for authentication)
54
+ AUTH0_DOMAIN=your-auth0-domain
55
+ AUTH0_CLIENT_ID=your-auth0-client-id
56
+ AUTH0_CLIENT_SECRET=your-auth0-client-secret
57
+ AUTH0_AUDIENCE=your-auth0-audience
58
 
59
+ # Security
60
+ SECRET_KEY=your-session-secret-key
61
+
62
+ # Optional: App Configuration
63
+ GRADIO_SERVER_NAME=0.0.0.0
64
  GRADIO_SERVER_PORT=7860
 
65
  DEBUG=false
66
  ```
67
 
68
+ ### Setting Environment Variables
69
+ 1. Go to your **Space Settings**
70
+ 2. Find **"Repository secrets"** or **"Variables and secrets"**
71
+ 3. Add each variable with **"Private"** visibility for sensitive data
72
+ 4. **Restart the Space** after adding variables
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
+ ## Try the Examples
75
 
76
+ We've included sample news articles to demonstrate the verification capabilities:
77
+ - Suspicious breakthrough claims with questionable sources
78
+ - Real news with proper sourcing and verification
79
 
80
+ ## Architecture
 
 
 
 
 
81
 
82
+ This application uses:
83
+ - **FastAPI**: Backend API framework with Auth0 integration
84
+ - **Gradio**: Interactive web interface with multiple mounted apps
85
+ - **Auth0**: Secure authentication and user management
86
+ - **Session Management**: Trial tracking and user state management
87
+ - **Modular Design**: Clean separation of concerns with api/, config/, and components/ modules
88
 
89
+ ## API Integration
90
 
91
+ The app connects to a backend API for news verification. Make sure your backend API supports:
92
+ - `POST /api/verify` - Main verification endpoint
93
+ - `GET /api/health` - Health check endpoint
 
 
94
 
95
+ ## Local Development
96
 
97
+ To run locally:
98
+ 1. Clone this repository
99
+ 2. Install dependencies: `pip install -r requirements.txt`
100
+ 3. Set up your `.env` file with the required variables
101
+ 4. Run: `python app.py`
102
+ 5. Access at `http://localhost:3000`
103
 
104
+ ## Built With
 
 
 
105
 
106
+ - **Gradio**: Interactive web interface
107
+ - **FastAPI**: Modern, fast web framework
108
+ - **Auth0**: Authentication platform
109
+ - **Python**: Backend processing
110
+ - **Hugging Face Spaces**: Hosting platform
111
 
112
+ ---
 
 
 
113
 
114
+ *Built with ❀️ for fighting misinformation and promoting media literacy*