File size: 1,254 Bytes
fbb327c
 
 
 
 
 
 
 
 
 
 
 
 
 
0ac9668
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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: Remrofsnart
emoji: πŸ“š
colorFrom: yellow
colorTo: blue
sdk: gradio
sdk_version: 5.34.0
app_file: app.py
pinned: false
license: mit
short_description: previous token predictor
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# Reverse GPT-2 Generator

This is a Gradio app that uses a reverse-trained GPT-2 model to generate text that would logically come before a given prompt.

## Features

- Generate text that comes before your prompt
- Adjustable parameters:
  - Max tokens
  - Temperature
  - Top-k sampling
- User-friendly interface
- Real-time generation

## Local Development

1. Clone this repository
2. Create a virtual environment:
   ```bash
   python -m venv venv
   source venv/bin/activate  # On Windows use: venv\Scripts\activate
   ```
3. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```
4. Run the app:
   ```bash
   python app.py
   ```

## Usage

1. Enter a prompt (e.g., "And they lived happily ever after")
2. Adjust the generation parameters if desired
3. Click Submit to generate text

## Model

The app uses a reverse-trained GPT-2 model hosted on HuggingFace. The model is automatically downloaded when the app starts.

## License

MIT