File size: 1,589 Bytes
be7d5ac
 
 
 
 
 
 
 
 
 
 
 
 
 
a834908
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Trending Repos Analysis
emoji: 🐢
colorFrom: indigo
colorTo: red
sdk: gradio
sdk_version: 5.30.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Meta analysis about trends on trending repos
---

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

# SQL Dataset Visualizer on Hugging Face Spaces

This application allows you to query Hugging Face datasets using SQL and visualize the results using Plotly.

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

2. Set up authentication:
   - Get your Hugging Face token from https://huggingface.co/settings/tokens
   - For local development, set the environment variable:
     ```bash
     export HF_TOKEN=your_token_here
     ```
   - For Hugging Face Spaces, add the token in the Space settings:
     - Go to your Space settings
     - Add a new secret with key `HF_TOKEN` and your token as the value

## Run Locally
```bash
python app.py
```

## Deploy to Hugging Face Spaces
1. Push these files to a new Python Space on HF
2. Add your HF_TOKEN in the Space settings
3. The Space will automatically deploy with the token securely stored

## Usage
1. Enter your SQL query in the text box
2. The results will be automatically visualized as a bar chart
3. If there's an error in your query, it will be displayed as text

## Security Note
- Never commit your HF_TOKEN to version control
- Always use environment variables or Space secrets for authentication
- The token is used to access private datasets and authenticate API requests