Ben Beinke commited on
Commit
d8b2921
·
1 Parent(s): 59020ec

initial commit

Browse files
Files changed (5) hide show
  1. .python-version +1 -0
  2. README.md +117 -10
  3. app.py +222 -0
  4. pyproject.toml +9 -0
  5. uv.lock +0 -0
.python-version ADDED
@@ -0,0 +1 @@
 
 
1
+ 3.12
README.md CHANGED
@@ -1,12 +1,119 @@
1
  # 💗Likable
2
  It's almost Lovable - Build Gradio apps, using only a chat interface.
3
- ### Notes
4
- - UI - Chat, Preview, Code
5
- - Deploy directly to huggingface spaces
6
- - Code execution - on host or sandbox E2B?
7
- - Agents:
8
- - Planner (?)
9
- - Coder
10
- - files (read, write, overwrite, search) - handle diff editing
11
- - command line
12
- - Reviewer (Visual)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # 💗Likable
2
  It's almost Lovable - Build Gradio apps, using only a chat interface.
3
+
4
+ ## 🚀 Features
5
+
6
+ - **Chat Interface**: Natural language conversation with AI to describe what you want to build
7
+ - **Live Preview**: See your generated application in real-time
8
+ - **Code View**: Toggle to view the generated Python/Gradio code
9
+ - **Example Prompts**: Get started quickly with pre-built examples
10
+ - **Modern UI**: Clean, responsive interface inspired by Lovable
11
+
12
+ ## 🛠️ Setup
13
+
14
+ ### Prerequisites
15
+ - Python 3.8+
16
+ - pip or uv for package management
17
+
18
+ ### Installation
19
+
20
+ Using uv (recommended):
21
+ ```bash
22
+ uv sync
23
+ ```
24
+
25
+ Or using pip:
26
+ ```bash
27
+ pip install -r requirements.txt
28
+ ```
29
+
30
+ ### Running the Application
31
+
32
+ ```bash
33
+ python app.py
34
+ ```
35
+
36
+ Or use the launcher:
37
+ ```bash
38
+ python run.py
39
+ ```
40
+
41
+ The application will be available at `http://localhost:7860`
42
+
43
+ ## 🎯 Usage
44
+
45
+ 1. **Start a Conversation**: Type what you want to build in the chat interface
46
+ 2. **View Results**: See the generated app preview on the right
47
+ 3. **Toggle Views**: Switch between "Preview" and "Code" to see the implementation
48
+ 4. **Iterate**: Continue chatting to refine and improve your application
49
+
50
+ ### Example Prompts
51
+ - "Create a simple todo app"
52
+ - "Build a calculator interface"
53
+ - "Make a weather dashboard"
54
+ - "Design a photo gallery"
55
+ - "Create a chat interface"
56
+
57
+ ## 🏗️ Architecture
58
+
59
+ ### Components
60
+ - **Chat Interface** (Left Panel)
61
+ - AI-powered conversation
62
+ - Example prompts
63
+ - Message history
64
+
65
+ - **Preview/Code Panel** (Right Panel)
66
+ - Live HTML preview of generated apps
67
+ - Syntax-highlighted code view
68
+ - Toggle between views
69
+
70
+ ### Tech Stack
71
+ - **Gradio**: Web UI framework
72
+ - **Python**: Backend logic
73
+ - **HTML/CSS**: Preview rendering
74
+
75
+ ## 🔮 Roadmap
76
+
77
+ ### Planned Features
78
+ - [ ] **Real AI Integration**: Connect to actual LLM APIs
79
+ - [ ] **Code Execution**: Run generated code in sandbox (E2B integration)
80
+ - [ ] **HuggingFace Deployment**: One-click deployment to HF Spaces
81
+ - [ ] **Advanced Agents**:
82
+ - [ ] Planner Agent (architecture decisions)
83
+ - [ ] Coder Agent (file management, diff editing)
84
+ - [ ] Reviewer Agent (visual testing)
85
+ - [ ] **File Management**:
86
+ - [ ] Read/write/edit files
87
+ - [ ] Project structure management
88
+ - [ ] Git integration
89
+ - [ ] **Enhanced Preview**:
90
+ - [ ] Real Gradio app embedding
91
+ - [ ] Interactive previews
92
+ - [ ] Mobile responsive testing
93
+
94
+ ### Current Status
95
+ ✅ Basic UI layout
96
+ ✅ Chat interface mockup
97
+ ✅ Preview/Code toggle
98
+ ✅ Example system
99
+ 🚧 AI integration (mock responses)
100
+ 🚧 Real code generation
101
+ 🚧 Live app deployment
102
+
103
+ ## 🤝 Contributing
104
+
105
+ 1. Fork the repository
106
+ 2. Create a feature branch
107
+ 3. Make your changes
108
+ 4. Test thoroughly
109
+ 5. Submit a pull request
110
+
111
+ ## 📄 License
112
+
113
+ MIT License - see LICENSE file for details
114
+
115
+ ## 🙏 Acknowledgments
116
+
117
+ - Inspired by [Lovable](https://lovable.dev/) - the AI-powered web app builder
118
+ - Built with [Gradio](https://gradio.app/) - the fastest way to build ML demos
119
+ - UI design patterns from modern development tools
app.py ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import time
3
+ import random
4
+
5
+
6
+ gr.NO_RELOAD = False
7
+
8
+
9
+ # Mock function to simulate AI responses
10
+ def simulate_ai_response(message, history):
11
+ """Simulate an AI response for demonstration purposes"""
12
+ time.sleep(1) # Simulate processing time
13
+
14
+ # Simple demo responses
15
+ responses = [
16
+ "I'll help you build that! Let me generate some code for you.",
17
+ "Great idea! I'm working on implementing that feature.",
18
+ "Here's what I can create for you based on your request.",
19
+ "Let me design that component and show you a preview.",
20
+ "I understand what you need. I'll code that up right now!",
21
+ ]
22
+
23
+ response = random.choice(responses)
24
+ history.append([message, response])
25
+ return history, ""
26
+
27
+
28
+ # Mock functions for preview and code
29
+ def get_preview_content():
30
+ """Return HTML content for preview"""
31
+ return """
32
+ <div style="padding: 20px; font-family: Arial, sans-serif;">
33
+ <h2>Preview - Generated App</h2>
34
+ <div style="border: 1px solid #ddd; padding: 15px; margin: 10px 0; border-radius: 8px;">
35
+ <h3>Todo App</h3>
36
+ <input type="text" placeholder="Add a new task..." style="width: 70%; padding: 8px; margin-right: 10px;">
37
+ <button style="padding: 8px 15px; background: #007bff; color: white; border: none; border-radius: 4px;">Add</button>
38
+ <ul style="margin-top: 15px; list-style-type: none; padding: 0;">
39
+ <li style="padding: 8px; border-bottom: 1px solid #eee;">✓ Learn Gradio</li>
40
+ <li style="padding: 8px; border-bottom: 1px solid #eee;">✓ Build awesome UIs</li>
41
+ <li style="padding: 8px; border-bottom: 1px solid #eee;">⬜ Deploy to HuggingFace</li>
42
+ </ul>
43
+ </div>
44
+ <p style="color: #666; font-size: 14px;">This is a live preview of your generated application.</p>
45
+ </div>
46
+ """
47
+
48
+
49
+ def get_code_content():
50
+ """Return code content for the code view"""
51
+ return """import gradio as gr
52
+
53
+ def add_task(new_task, tasks):
54
+ if new_task.strip():
55
+ tasks.append(new_task)
56
+ return "", tasks
57
+
58
+ def create_todo_app():
59
+ with gr.Blocks() as app:
60
+ gr.Markdown("# Todo App")
61
+
62
+ with gr.Row():
63
+ new_task = gr.Textbox(
64
+ placeholder="Add a new task...",
65
+ scale=3,
66
+ container=False
67
+ )
68
+ add_btn = gr.Button("Add", scale=1)
69
+
70
+ task_list = gr.Dataframe(
71
+ headers=["Tasks"],
72
+ datatype=["str"],
73
+ interactive=False
74
+ )
75
+
76
+ add_btn.click(
77
+ add_task,
78
+ inputs=[new_task, task_list],
79
+ outputs=[new_task, task_list]
80
+ )
81
+
82
+ new_task.submit(
83
+ add_task,
84
+ inputs=[new_task, task_list],
85
+ outputs=[new_task, task_list]
86
+ )
87
+
88
+ return app
89
+
90
+ if __name__ == "__main__":
91
+ demo = create_todo_app()
92
+ demo.launch()"""
93
+
94
+
95
+ # Create the main Lovable-style UI
96
+ def create_lovable_ui():
97
+ with gr.Blocks(
98
+ title="💗Likable",
99
+ theme=gr.themes.Soft(),
100
+ css="""
101
+ .main-container {
102
+ height: 100vh;
103
+ }
104
+ .chat-container {
105
+ height: 80vh;
106
+ border-right: 1px solid #e0e0e0;
107
+ }
108
+ .content-container {
109
+ height: 80vh;
110
+ }
111
+ """,
112
+ ) as demo:
113
+ gr.Markdown("# 💗Likable")
114
+ gr.Markdown(
115
+ "*It's almost Lovable - Build Gradio apps using only a chat interface*"
116
+ )
117
+
118
+ with gr.Tabs():
119
+ # Preview Tab
120
+ with gr.TabItem("Preview"):
121
+ with gr.Row(elem_classes="main-container"):
122
+ # Left side - Chat Interface
123
+ with gr.Column(scale=1, elem_classes="chat-container"):
124
+ gr.Markdown("### 💬 Chat with AI")
125
+
126
+ chatbot_preview = gr.Chatbot(
127
+ height=500,
128
+ show_copy_button=True,
129
+ avatar_images=(None, "🤖"),
130
+ bubble_full_width=False,
131
+ )
132
+
133
+ with gr.Row():
134
+ msg_input_preview = gr.Textbox(
135
+ placeholder="Describe what you want to build...",
136
+ scale=4,
137
+ container=False,
138
+ )
139
+ send_btn_preview = gr.Button(
140
+ "Send", scale=1, variant="primary"
141
+ )
142
+
143
+ # Right side - Preview Content
144
+ with gr.Column(scale=4, elem_classes="content-container"):
145
+ with gr.Row():
146
+ gr.Button(
147
+ "Deploy to HF Spaces", variant="secondary", scale=1
148
+ )
149
+
150
+ preview_html = gr.HTML(value=get_preview_content())
151
+
152
+ # Code Tab
153
+ with gr.TabItem("Code"):
154
+ with gr.Row(elem_classes="main-container"):
155
+ # Left side - Chat Interface
156
+ with gr.Column(scale=1, elem_classes="chat-container"):
157
+ gr.Markdown("### 💬 Chat with AI")
158
+
159
+ chatbot_code = gr.Chatbot(
160
+ height=500,
161
+ show_copy_button=True,
162
+ avatar_images=(None, "🤖"),
163
+ bubble_full_width=False,
164
+ )
165
+
166
+ with gr.Row():
167
+ msg_input_code = gr.Textbox(
168
+ placeholder="Describe what you want to build...",
169
+ scale=4,
170
+ container=False,
171
+ )
172
+ send_btn_code = gr.Button(
173
+ "Send", scale=1, variant="primary"
174
+ )
175
+
176
+ # Right side - Code Content
177
+ with gr.Column(scale=4, elem_classes="content-container"):
178
+ with gr.Row():
179
+ gr.Button(
180
+ "Deploy to HF Spaces", variant="secondary", scale=1
181
+ )
182
+
183
+ code_view = gr.Code(
184
+ value=get_code_content(),
185
+ language="python",
186
+ lines=20,
187
+ wrap_lines=True,
188
+ show_label=False,
189
+ )
190
+
191
+ # Event handlers for Preview tab
192
+ msg_input_preview.submit(
193
+ simulate_ai_response,
194
+ inputs=[msg_input_preview, chatbot_preview],
195
+ outputs=[chatbot_preview, msg_input_preview],
196
+ )
197
+
198
+ send_btn_preview.click(
199
+ simulate_ai_response,
200
+ inputs=[msg_input_preview, chatbot_preview],
201
+ outputs=[chatbot_preview, msg_input_preview],
202
+ )
203
+
204
+ # Event handlers for Code tab
205
+ msg_input_code.submit(
206
+ simulate_ai_response,
207
+ inputs=[msg_input_code, chatbot_code],
208
+ outputs=[chatbot_code, msg_input_code],
209
+ )
210
+
211
+ send_btn_code.click(
212
+ simulate_ai_response,
213
+ inputs=[msg_input_code, chatbot_code],
214
+ outputs=[chatbot_code, msg_input_code],
215
+ )
216
+
217
+ return demo
218
+
219
+
220
+ if __name__ == "__main__":
221
+ demo = create_lovable_ui()
222
+ demo.launch(debug=True)
pyproject.toml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "likable"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ dependencies = [
8
+ "gradio>=5.32.0",
9
+ ]
uv.lock ADDED
The diff for this file is too large to render. See raw diff