Spaces:
Running
Running
File size: 3,214 Bytes
2e5ba5f | 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 113 114 115 116 117 118 | # β‘ Grokflow
**Build AI-powered apps visually β no code needed.**
Grokflow is a block-based AI app builder that runs on Hugging Face Spaces, powered by xAI's Grok model. Snap together input blocks, AI blocks, and output blocks to create custom AI workflows in minutes.
---
## What it does
Grokflow lets you build AI apps the same way you'd build with Lego β one block at a time. Connect blocks using `{{variable}}` references and hit **Run All** to execute the whole pipeline.

---
## Block types
| Block | Type | Description |
|---|---|---|
| π Text Input | Input | Free-form text the user fills in |
| β° Dropdown | Input | Choose from a list of options |
| β Slider | Input | Numeric value picker with min/max/step |
| β¦ AI Generate | AI | Generate text from a prompt template |
| π¬ AI Chat | AI | Full multi-turn conversation with Grok |
| β³ AI Transform | AI | Rewrite or edit text with a prompt |
| β¦ Display | Output | Show the value of any variable |
---
## How to use
### 1. Add blocks
Click any block button in the toolbar to add it to your canvas.
### 2. Name your variables
Each block has a **variable name** (e.g. `block_1`). This is how other blocks reference its value.
### 3. Connect blocks
In any AI prompt, use `{{variable_name}}` to inject another block's value. For example:
```
Write a {{tone}} blog post about {{topic}}.
```
Where `tone` and `topic` are variable names from your input blocks.
### 4. Run
- Click **βΆ** on a single block to run just that block
- Click **βΆ Run All** to execute all blocks in order (inputs β AI β display)
---
## Example app: Blog Post Generator
| Block | Type | Config |
|---|---|---|
| Topic | Text Input | Variable: `topic` |
| Tone | Dropdown | Options: Professional, Casual, Funny Β· Variable: `tone` |
| Writer | AI Generate | Prompt: `Write a {{tone}} 3-paragraph blog post about {{topic}}.` |
| Result | Display | Shows: `{{writer}}` |
Hit **Run All** β instant blog post.
---
## Setup on Hugging Face Spaces
### Files needed
```
your-space/
βββ app.py
βββ requirements.txt
```
### Add your API key
1. Go to your Space β **Settings β Variables and secrets**
2. Add a new secret:
- Name: `XAI_API_KEY`
- Value: your xAI API key from [console.x.ai](https://console.x.ai)
### Deploy
Push both files β the Space builds automatically. Takes about 60 seconds.
---
## Model
Grokflow uses **xAI Grok** via the OpenAI-compatible API endpoint:
```
https://api.x.ai/v1/chat/completions
model: grok-4-1-fast-non-reasoning
```
---
## Tech stack
- **[Gradio](https://gradio.app)** β UI framework
- **[xAI Grok API](https://console.x.ai)** β language model
- **Python** β all logic, no JavaScript, no HTML files
---
## Tips
- Variable names must be a single word with no spaces (e.g. `my_topic` not `my topic`)
- AI blocks run in the order they appear β put inputs first, AI blocks second, display blocks last
- The AI Chat block keeps full conversation history within a session
- Use the system prompt field to give each AI block a specific persona or set of instructions
---
## License
MIT β free to use, fork, and build on.
|