156}
157158.garden-card-image {
159width: 100%;
160height: 200px;
Freelancingindex.html1 match
7<script src="https://cdn.twind.style" crossorigin></script>
8<script src="https://esm.town/v/std/catch"></script>
9<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>๐ผ</text></svg>">
10<style>
11/* Custom animations and styles */
8
9<!-- Favicon -->
10<link rel="icon" type="image/svg+xml" href="/frontend/favicon.svg">
11
12<!-- TailwindCSS -->
Eaglemajdeshomeandservicestypes.ts8 matches
10totalPlots: number;
11amenities: string[];
12images: string[];
13featured: boolean;
14}
96totalPlots: 100,
97amenities: ['24/7 Security', 'Good Road Network', 'Electricity', 'Water Supply', 'Drainage System'],
98images: [],
99featured: true
100},
108totalPlots: 80,
109amenities: ['Gated Community', 'Recreation Center', 'Shopping Complex', 'School', 'Hospital'],
110images: [],
111featured: true
112},
120totalPlots: 120,
121amenities: ['Security', 'Road Network', 'Electricity', 'Water'],
122images: [],
123featured: false
124},
132totalPlots: 90,
133amenities: ['Playground', 'Security', 'Good Roads', 'Power Supply'],
134images: [],
135featured: false
136},
144totalPlots: 50,
145amenities: ['Luxury Clubhouse', 'Swimming Pool', 'Gym', 'Security', 'Parking'],
146images: [],
147featured: true
148},
156totalPlots: 85,
157amenities: ['Security', 'Good Roads', 'Electricity', 'Water Supply'],
158images: [],
159featured: false
160},
168totalPlots: 110,
169amenities: ['Green Spaces', 'Security', 'Road Network', 'Utilities'],
170images: [],
171featured: false
172}
Createajobpostingindex.html1 match
7<script src="https://cdn.twind.style" crossorigin></script>
8<script src="https://esm.town/v/std/catch"></script>
9<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>๐ผ</text></svg>">
10</head>
11<body class="bg-gray-50 min-h-screen">
templateTwitterAlertREADME.md3 matches
9## Example
10This val tracks mentions of "Val Town" and related terms, excluding noise like retweets and irrelevant accounts. Notifications are sent to a Discord webhook but can be easily reconfigured for other platforms.
11<img src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/85912106-f625-443e-5321-6e2699453200/public" width="500"/>
12To see exactly how we use this template at Val Town: https://www.val.town/x/stevekrouse/twitterAlert
1316### 1. Fork this Val
17To use this template, fork this val on the top right corner of this page.
18
1920### 2. View Source Code
21<em>The `CODE` box shows you the the full source code of this val, you may need to scroll down to see it.</em>
22
2324### 3. Customize Query
untitled-5321README.md5 matches
1# AI Tool App
23A comprehensive AI assistant that can answer questions and generate images.
45## Features
67- **Chat Interface**: Ask questions and get AI-powered responses using GPT-4
8- **Image Generation**: Generate images from text descriptions using AI
9- **Real-time Interface**: Clean, responsive UI with real-time interactions
1018โ โ โโโ App.tsx # Main application component
19โ โ โโโ ChatInterface.tsx # Chat component for Q&A
20โ โ โโโ ImageGenerator.tsx # Image generation component
21โ โโโ index.html # Main HTML template
22โ โโโ index.tsx # Frontend entry point
31- `GET /` - Serves the main application
32- `POST /api/chat` - Handles chat/question requests
33- `POST /api/generate-image` - Handles image generation requests
3435## Environment Variables
411. Navigate to the app URL
422. Use the chat interface to ask questions
433. Use the image generator to create images from descriptions
444. Switch between modes using the tab interface
untitled-5321index.ts16 matches
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import type { ChatRequest, ChatResponse, ImageGenerationRequest, ImageGenerationResponse } from "../shared/types.ts";
56const app = new Hono();
87});
8889// Image generation API endpoint
90app.post("/api/generate-image", async c => {
91try {
92const body: ImageGenerationRequest = await c.req.json();
93
94if (!body.prompt?.trim()) {
95return c.json<ImageGenerationResponse>({
96imageUrl: "",
97success: false,
98error: "Prompt is required"
100}
101102const response = await openai.images.generate({
103model: "dall-e-3",
104prompt: body.prompt,
108});
109110const imageUrl = response.data[0]?.url;
111
112if (!imageUrl) {
113throw new Error("No image URL returned from OpenAI");
114}
115116return c.json<ImageGenerationResponse>({
117imageUrl: imageUrl,
118success: true
119});
120121} catch (error) {
122console.error("Image generation error:", error);
123return c.json<ImageGenerationResponse>({
124imageUrl: "",
125success: false,
126error: "Failed to generate image. Please try again with a different prompt."
127}, 500);
128}
untitled-5321ImageGenerator.tsx40 matches
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
3import type { ImageGenerationRequest, ImageGenerationResponse } from "../../shared/types.ts";
45interface GeneratedImage {
6id: string;
7prompt: string;
10}
1112export default function ImageGenerator() {
13const [prompt, setPrompt] = useState('');
14const [size, setSize] = useState<'256x256' | '512x512' | '1024x1024'>('1024x1024');
15const [isGenerating, setIsGenerating] = useState(false);
16const [generatedImages, setGeneratedImages] = useState<GeneratedImage[]>([]);
17const [error, setError] = useState<string | null>(null);
1819const generateImage = async () => {
20if (!prompt.trim() || isGenerating) return;
212425try {
26const request: ImageGenerationRequest = {
27prompt: prompt.trim(),
28size: size
29};
3031const response = await fetch('/api/generate-image', {
32method: 'POST',
33headers: {
37});
3839const data: ImageGenerationResponse = await response.json();
4041if (data.success) {
42const newImage: GeneratedImage = {
43id: Date.now().toString(),
44prompt: prompt.trim(),
45url: data.imageUrl,
46timestamp: new Date()
47};
48setGeneratedImages(prev => [newImage, ...prev]);
49setPrompt('');
50} else {
51setError(data.error || 'Failed to generate image');
52}
53} catch (error) {
54console.error('Error generating image:', error);
55setError('Failed to generate image. Please try again.');
56} finally {
57setIsGenerating(false);
62if (e.key === 'Enter' && !e.shiftKey) {
63e.preventDefault();
64generateImage();
65}
66};
6768const clearImages = () => {
69setGeneratedImages([]);
70setError(null);
71};
7273const downloadImage = async (imageUrl: string, prompt: string) => {
74try {
75const response = await fetch(imageUrl);
76const blob = await response.blob();
77const url = window.URL.createObjectURL(blob);
84document.body.removeChild(a);
85} catch (error) {
86console.error('Error downloading image:', error);
87}
88};
91<div className="bg-white rounded-lg shadow-lg p-6">
92<div className="flex justify-between items-center mb-4">
93<h2 className="text-2xl font-semibold text-gray-800">Image Generator</h2>
94{generatedImages.length > 0 && (
95<button
96onClick={clearImages}
97className="px-4 py-2 text-sm bg-gray-100 hover:bg-gray-200 rounded-md transition-colors"
98>
99Clear Images
100</button>
101)}
106<div className="mb-4">
107<label className="block text-sm font-medium text-gray-700 mb-2">
108Image Description
109</label>
110<textarea
112onChange={(e) => setPrompt(e.target.value)}
113onKeyPress={handleKeyPress}
114placeholder="Describe the image you want to generate... (Press Enter to generate)"
115className="w-full p-3 border rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500"
116rows={3}
122<div className="flex-1">
123<label className="block text-sm font-medium text-gray-700 mb-2">
124Image Size
125</label>
126<select
136</div>
137<button
138onClick={generateImage}
139disabled={!prompt.trim() || isGenerating}
140className="px-6 py-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:bg-gray-300 disabled:cursor-not-allowed transition-colors"
156<div className="mb-6 p-8 text-center bg-gray-50 rounded-lg">
157<div className="text-4xl mb-2">๐จ</div>
158<p className="text-gray-600">Creating your image...</p>
159<div className="mt-2">
160<div className="inline-block animate-spin rounded-full h-6 w-6 border-b-2 border-blue-500"></div>
163)}
164165{/* Generated Images */}
166<div className="image-container">
167{generatedImages.length === 0 && !isGenerating ? (
168<div className="text-center text-gray-500 py-8">
169<div className="text-4xl mb-2">๐ผ๏ธ</div>
170<p>No images generated yet. Describe an image to get started!</p>
171</div>
172) : (
173<div className="grid gap-6">
174{generatedImages.map((image) => (
175<div key={image.id} className="generated-image border rounded-lg p-4 bg-gray-50">
176<div className="mb-3">
177<h3 className="font-medium text-gray-800 mb-1">"{image.prompt}"</h3>
178<p className="text-sm text-gray-500">
179Generated on {image.timestamp.toLocaleString()}
180</p>
181</div>
182<div className="relative group">
183<img
184src={image.url}
185alt={image.prompt}
186className="w-full rounded-lg shadow-md"
187loading="lazy"
189<div className="absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-20 transition-all duration-200 rounded-lg flex items-center justify-center">
190<button
191onClick={() => downloadImage(image.url, image.prompt)}
192className="opacity-0 group-hover:opacity-100 transition-opacity duration-200 px-4 py-2 bg-white text-gray-800 rounded-lg shadow-md hover:bg-gray-100"
193>
untitled-5321App.tsx7 matches
2import React, { useState } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
3import ChatInterface from "./ChatInterface.tsx";
4import ImageGenerator from "./ImageGenerator.tsx";
56type TabType = 'chat' | 'image';
78export default function App() {
18</h1>
19<p className="text-gray-600 text-lg">
20Your intelligent assistant for questions and image generation
21</p>
22</div>
36</button>
37<button
38onClick={() => setActiveTab('image')}
39className={`px-6 py-3 rounded-md font-medium transition-all duration-200 ${
40activeTab === 'image'
41? 'bg-blue-500 text-white shadow-md'
42: 'text-gray-600 hover:text-blue-500'
43}`}
44>
45๐จ Image Generator
46</button>
47</div>
51<div className="max-w-4xl mx-auto">
52{activeTab === 'chat' && <ChatInterface />}
53{activeTab === 'image' && <ImageGenerator />}
54</div>
55</div>