alinia/sec-red-teaming-competition
1
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Setup Instructions
1. Supabase Database (Required for data collection)
This app uses Supabase (PostgreSQL) to collect student interactions and feedback. Follow these steps:
Step 1: Create a Supabase Project
- Go to supabase.com and sign up (free tier available).
- Create a new project (takes ~1 minute).
- Note your Project URL and Anon Key from the project settings.
Step 2: Create Tables
In the Supabase SQL Editor, run these commands:
-- WARNING: This schema is for context only and is not meant to be run.
-- Table order and constraints may not be valid for execution.
CREATE TABLE public.feedback (
id integer NOT NULL DEFAULT nextval('feedback_id_seq'::regclass),
interaction_id integer,
username text NOT NULL,
rating integer,
optional_text text,
created_at timestamp without time zone DEFAULT now(),
CONSTRAINT feedback_pkey PRIMARY KEY (id),
CONSTRAINT feedback_interaction_id_fkey FOREIGN KEY (interaction_id) REFERENCES public.interactions(id)
);
CREATE TABLE public.interactions (
id integer NOT NULL DEFAULT nextval('interactions_id_seq'::regclass),
username text NOT NULL,
query text NOT NULL,
model_used text,
response text,
guardrail_flagged boolean DEFAULT false,
guardrail_action text,
created_at timestamp without time zone DEFAULT now(),
CONSTRAINT interactions_pkey PRIMARY KEY (id)
);2. Environment Variables
Set these environment variables on Hugging Face Spaces (or locally):
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-anon-key
ALINIA_API_KEY=your-alinia-key
ALINIA_API_URL=https://staging.api.alinia.ai3. Run the App
pip install -r requirements.txt
python3 app.pyThe app will start on http://localhost:7860 (or similar).
After Class: Export Data
To download the collected data:
- Go to your Supabase project dashboard.
- In the Data Editor, select the
interactionsorfeedbacktable. - Click the menu (⋮) → Download as CSV.
- Use the CSV files for analysis or model training.
