File size: 3,243 Bytes
102ae18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# ConGr Visualizer Web Interface

A web-based interface for exploring and visualizing ConGrs (Consensus Graphs) from research datasets.

## Features

### Browse Existing Graphs
- **Dataset Selection**: Choose from available datasets (BIO, FP, HIST, REFS, MATH, AIME)
- **Entity Selection**: Browse entities within each dataset
- **Model Information**: See which language models were used for each graph
- **Graph Visualization**: Interactive network visualization using vis.js
- **Metadata Display**: View graph statistics and consensus text

### Create New Graphs
- **Text Input**: Enter multiple text sequences to create new ConGrs
- **Real-time Visualization**: See the graph structure as it's created
- **Save Functionality**: Save created graphs to pickle files

## Available Datasets

- **BIO**: Biography datasets with various public figures
- **FP**: False Presupposition datasets
- **HIST**: Historical events datasets
- **REFS**: Reference datasets
- **MATH**: Mathematical problem datasets
- **AIME**: American Invitational Mathematics Examination datasets

## Models

The graphs are generated using various language models:
- olmo7b
- qwen72b
- llama70b
- llama8b

## Installation

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

2. Start the server:
```bash
python server.py
```

3. Open your browser and navigate to:
```
http://localhost:8080
```

## Usage

### Browsing Existing Graphs

1. **Select Dataset**: Choose a dataset from the dropdown menu
2. **Select Entity**: Choose an entity from the available options
3. **View Graph**: The graph will be automatically loaded and displayed
4. **View Information**: Graph metadata and consensus text will be shown

### Creating New Graphs

1. **Enter Text**: Input multiple text sequences (one per line)
2. **Create Graph**: Click "Create Graph" to generate a new ConGr
3. **Save Graph**: Optionally save the graph to a pickle file

## API Endpoints

- `GET /api/datasets` - Get available datasets
- `GET /api/entities?dataset=<dataset>` - Get entities for a dataset
- `POST /api/load_existing_graph` - Load an existing graph
- `POST /api/create_graph` - Create a new graph from text sequences
- `POST /api/save_graph` - Save a graph to file

## Testing

Run the test script to verify the server is working correctly:

```bash
python test_server.py
```

## File Structure

```
web_interface/
β”œβ”€β”€ server.py          # Flask server
β”œβ”€β”€ index.html         # Web interface
β”œβ”€β”€ requirements.txt   # Python dependencies
β”œβ”€β”€ test_server.py     # Test script
└── README.md         # This file
```

## Graph Information

When viewing a graph, you can see:
- **Dataset**: The source dataset
- **Entity**: The specific entity or topic
- **Model**: The language model used
- **Sequences**: Number of input sequences
- **Nodes**: Number of nodes in the graph
- **Edges**: Number of edges in the graph
- **Consensus**: The consensus text generated from the graph

## Visualization Features

- **Hierarchical Layout**: Graphs are displayed in a hierarchical structure
- **Color Coding**: Consensus nodes are highlighted in green
- **Interactive**: Zoom, pan, and hover for more information
- **Responsive**: Works on desktop and mobile devices