File size: 1,531 Bytes
c9bca7c
95dc7c2
c9bca7c
 
 
 
 
 
 
 
 
95dc7c2
c9bca7c
95dc7c2
c9bca7c
 
95dc7c2
 
 
 
 
c9bca7c
 
95dc7c2
 
 
 
c9bca7c
 
 
 
95dc7c2
 
c9bca7c
 
 
 
95dc7c2
 
 
 
 
c9bca7c
 
 
 
95dc7c2
c9bca7c
 
95dc7c2
 
 
 
 
c9bca7c
 
95dc7c2
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: Gemini + Claude Distractor Generator
emoji: 🧠
colorFrom: indigo
colorTo: pink
sdk: gradio
sdk_version: "4.26.0"
app_file: app.py
pinned: false
---

# Gemini + Claude Distractor Generator

This is a web app that uses **Gemini 1.5 Flash (Free Tier)** to generate multiple-choice distractors and then uses **Claude 3.5 Sonnet (via OpenRouter)** to **rank the distractors** based on how confusing they are.

## Features

- Generates distractors using Gemini 1.5 Flash
- Uses Claude Sonnet 3.5 to evaluate and rank distractors (LLM-as-Judge)
- Displays the correct answer, distractors, and Claude's ranking
- Simple and clean Gradio UI

## Files

- `app.py`: Main Gradio application logic
- `requirements.txt`: Dependencies
- `README.md`: This file

## How to Run

### Locally

1. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

2. Set your API keys inside `app.py`:
   - Gemini API key (for generation)
   - OpenRouter API key (for ranking via Claude)

3. Run:
   ```bash
   python app.py
   ```

4. Open the Gradio link shown in your terminal.

### On Hugging Face Spaces

1. Upload `app.py`, `requirements.txt`, and `README.md`
2. Choose `Gradio` as the SDK
3. Make sure to set your **Gemini API key** and **OpenRouter API key** via HF secrets or hardcode for testing
4. Set `app.py` as your main file (`app_file`)

## Notes

- Claude is used only to rank distractors; Gemini handles generation.
- Free-tier Gemini is slower and limited — ranking may take longer due to OpenRouter limits.