5dimension commited on
Commit
0c1c66a
·
verified ·
1 Parent(s): 2e8551b

make crew ai agents using public api , from huggingface or somewhere

Browse files
Files changed (6) hide show
  1. README.md +8 -5
  2. components/footer.js +132 -0
  3. components/navigation.js +98 -0
  4. index.html +208 -19
  5. script.js +258 -0
  6. style.css +81 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Agentcrew Ai Orchestrator
3
- emoji: 👁
4
- colorFrom: green
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: AgentCrew AI Orchestrator 🤖
3
+ colorFrom: gray
4
+ colorTo: blue
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class AIFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ width: 100%;
9
+ }
10
+ footer {
11
+ background-color: #1e293b;
12
+ color: white;
13
+ padding: 2rem 0;
14
+ }
15
+ .footer-container {
16
+ max-width: 1200px;
17
+ margin: 0 auto;
18
+ padding: 0 1rem;
19
+ }
20
+ .footer-content {
21
+ display: grid;
22
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
23
+ gap: 2rem;
24
+ }
25
+ .footer-section h3 {
26
+ color: #0ea5e9;
27
+ margin-bottom: 1rem;
28
+ font-size: 1.125rem;
29
+ }
30
+ .footer-links {
31
+ list-style: none;
32
+ }
33
+ .footer-links li {
34
+ margin-bottom: 0.5rem;
35
+ }
36
+ .footer-links a {
37
+ color: #cbd5e1;
38
+ text-decoration: none;
39
+ transition: color 0.3s ease;
40
+ }
41
+ .footer-links a:hover {
42
+ color: #0ea5e9;
43
+ }
44
+ .footer-bottom {
45
+ border-top: 1px solid #334155;
46
+ margin-top: 2rem;
47
+ padding-top: 1rem;
48
+ text-align: center;
49
+ color: #94a3b8;
50
+ }
51
+ .social-links {
52
+ display: flex;
53
+ gap: 1rem;
54
+ margin-top: 1rem;
55
+ }
56
+ .social-links a {
57
+ color: #cbd5e1;
58
+ transition: color 0.3s ease;
59
+ }
60
+ .social-links a:hover {
61
+ color: #0ea5e9;
62
+ }
63
+ </style>
64
+ <footer>
65
+ <div class="footer-container">
66
+ <div class="footer-content">
67
+ <div class="footer-section">
68
+ <h3>AgentCrew AI</h3>
69
+ <p>Empowering developers with multi-agent AI orchestration through Hugging Face APIs.</p>
70
+ <div class="social-links mt-4">
71
+ <a href="#"><i data-feather="github"></i></a>
72
+ <a href="#"><i data-feather="twitter"></i></a>
73
+ <a href="#"><i data-feather="linkedin"></i></a>
74
+ <a href="#"><i data-feather="mail"></i></a>
75
+ </div>
76
+ </div>
77
+
78
+ <div class="footer-section">
79
+ <h3>Agents</h3>
80
+ <ul class="footer-links">
81
+ <li><a href="/text-generator.html">Text Generator</a></li>
82
+ <li><a href="/image-creator.html">Image Creator</a></li>
83
+ <li><a href="/sentiment-analyzer.html">Sentiment Analyzer</a></li>
84
+ <li><a href="/translator.html">Translator</a></li>
85
+ <li><a href="/code-assistant.html">Code Assistant</a></li>
86
+ <li><a href="/audio-processor.html">Audio Processor</a></li>
87
+ </ul>
88
+ </div>
89
+
90
+ <div class="footer-section">
91
+ <h3>Resources</h3>
92
+ <ul class="footer-links">
93
+ <li><a href="/documentation.html">Documentation</a></li>
94
+ <li><a href="/api-status.html">API Status</a></li>
95
+ <li><a href="/examples.html">Examples</a></li>
96
+ <li><a href="/community.html">Community</a></li>
97
+ <li><a href="/blog.html">Blog</a></li>
98
+ </ul>
99
+ </div>
100
+
101
+ <div class="footer-section">
102
+ <h3>Support</h3>
103
+ <ul class="footer-links">
104
+ <li><a href="/help.html">Help Center</a></li>
105
+ <li><a href="/contact.html">Contact Us</a></li>
106
+ <li><a href="/privacy.html">Privacy Policy</a></li>
107
+ <li><a href="/terms.html">Terms of Service</a></li>
108
+ </ul>
109
+ </div>
110
+ </div>
111
+
112
+ <div class="footer-bottom">
113
+ <p>&copy; 2024 AgentCrew AI Orchestrator. All rights reserved.</p>
114
+ </div>
115
+ </div>
116
+ </footer>
117
+ `;
118
+
119
+ // Initialize Feather Icons in shadow DOM
120
+ const featherScript = document.createElement('script');
121
+ featherScript.src = 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js';
122
+ this.shadowRoot.appendChild(featherScript);
123
+
124
+ featherScript.onload = () => {
125
+ if (window.feather) {
126
+ window.feather.replace();
127
+ }
128
+ };
129
+ }
130
+ }
131
+
132
+ customElements.define('ai-footer', AIFooter);
components/navigation.js ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class AINavigation extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ width: 100%;
9
+ }
10
+ nav {
11
+ background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
12
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
13
+ }
14
+ .nav-container {
15
+ max-width: 1200px;
16
+ margin: 0 auto;
17
+ padding: 0 1rem;
18
+ }
19
+ .nav-content {
20
+ display: flex;
21
+ justify-content: space-between;
22
+ align-items: center;
23
+ height: 4rem;
24
+ }
25
+ .logo {
26
+ display: flex;
27
+ align-items: center;
28
+ color: white;
29
+ text-decoration: none;
30
+ font-weight: bold;
31
+ font-size: 1.25rem;
32
+ }
33
+ .nav-links {
34
+ display: flex;
35
+ align-items: center;
36
+ gap: 2rem;
37
+ }
38
+ .nav-link {
39
+ color: rgba(255, 255, 255, 0.9);
40
+ text-decoration: none;
41
+ transition: color 0.3s ease;
42
+ }
43
+ .nav-link:hover {
44
+ color: white;
45
+ }
46
+ .mobile-menu-btn {
47
+ display: none;
48
+ background: none;
49
+ border: none;
50
+ color: white;
51
+ cursor: pointer;
52
+ }
53
+ @media (max-width: 768px) {
54
+ .nav-links {
55
+ display: none;
56
+ }
57
+ .mobile-menu-btn {
58
+ display: block;
59
+ }
60
+ }
61
+ </style>
62
+ <nav>
63
+ <div class="nav-container">
64
+ <div class="nav-content">
65
+ <a href="/" class="logo">
66
+ <i data-feather="cpu"></i>
67
+ <span class="ml-2">AgentCrew</span>
68
+ </a>
69
+
70
+ <div class="nav-links">
71
+ <a href="/" class="nav-link">Dashboard</a>
72
+ <a href="/agents.html" class="nav-link">All Agents</a>
73
+ <a href="/api-status.html" class="nav-link">API Status</a>
74
+ <a href="/settings.html" class="nav-link">Settings</a>
75
+ </div>
76
+
77
+ <button class="mobile-menu-btn">
78
+ <i data-feather="menu"></i>
79
+ </button>
80
+ </div>
81
+ </div>
82
+ </nav>
83
+ `;
84
+
85
+ // Initialize Feather Icons in shadow DOM
86
+ const featherScript = document.createElement('script');
87
+ featherScript.src = 'https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js';
88
+ this.shadowRoot.appendChild(featherScript);
89
+
90
+ featherScript.onload = () => {
91
+ if (window.feather) {
92
+ window.feather.replace();
93
+ }
94
+ };
95
+ }
96
+ }
97
+
98
+ customElements.define('ai-navigation', AINavigation);
index.html CHANGED
@@ -1,19 +1,208 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AgentCrew AI Orchestrator</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <link rel="stylesheet" href="style.css">
9
+ <script src="https://cdn.tailwindcss.com"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ <script>
13
+ tailwind.config = {
14
+ theme: {
15
+ extend: {
16
+ colors: {
17
+ primary: {
18
+ 50: '#f0f9ff',
19
+ 100: '#e0f2fe',
20
+ 200: '#bae6fd',
21
+ 300: '#7dd3fc',
22
+ 400: '#38bdf8',
23
+ 500: '#0ea5e9',
24
+ 600: '#0284c7',
25
+ 700: '#0369a1',
26
+ 800: '#075985',
27
+ 900: '#0c4a6e',
28
+ },
29
+ secondary: {
30
+ 50: '#f8fafc',
31
+ 100: '#f1f5f9',
32
+ 200: '#e2e8f0',
33
+ 300: '#cbd5e1',
34
+ 400: '#94a3b8',
35
+ 500: '#64748b',
36
+ 600: '#475569',
37
+ 700: '#334155',
38
+ 800: '#1e293b',
39
+ 900: '#0f172a',
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ </script>
46
+ </head>
47
+ <body class="bg-gray-50 min-h-screen">
48
+ <ai-navigation></ai-navigation>
49
+
50
+ <main class="container mx-auto px-4 py-8">
51
+ <!-- Hero Section -->
52
+ <section class="text-center mb-16">
53
+ <h1 class="text-5xl font-bold text-primary-700 mb-4">
54
+ AgentCrew AI Orchestrator
55
+ </h1>
56
+ <p class="text-xl text-secondary-600 max-w-2xl mx-auto">
57
+ Harness the power of multiple AI agents working together through Hugging Face APIs
58
+ </p>
59
+ </section>
60
+
61
+ <!-- Agent Dashboard -->
62
+ <section class="mb-16">
63
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
64
+ <!-- Text Generation Agent -->
65
+ <div class="bg-white rounded-xl shadow-lg p-6 hover:shadow-xl transition-shadow">
66
+ <div class="flex items-center mb-4">
67
+ <div class="w-12 h-12 bg-primary-100 rounded-full flex items-center justify-center mr-4">
68
+ <i data-feather="edit-3" class="text-primary-600"></i>
69
+ </div>
70
+ <h3 class="text-xl font-semibold text-secondary-800">Text Generator</h3>
71
+ </div>
72
+ <p class="text-secondary-600 mb-4">Generate creative text using state-of-the-art language models</p>
73
+ <button onclick="openTextGenerator()" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-2 px-4 rounded-lg transition-colors">
74
+ Launch Agent
75
+ </button>
76
+ </div>
77
+
78
+ <!-- Image Generation Agent -->
79
+ <div class="bg-white rounded-xl shadow-lg p-6 hover:shadow-xl transition-shadow">
80
+ <div class="flex items-center mb-4">
81
+ <div class="w-12 h-12 bg-primary-100 rounded-full flex items-center justify-center mr-4">
82
+ <i data-feather="image" class="text-primary-600"></i>
83
+ </div>
84
+ <h3 class="text-xl font-semibold text-secondary-800">Image Creator</h3>
85
+ </div>
86
+ <p class="text-secondary-600 mb-4">Create stunning images from text descriptions</p>
87
+ <button onclick="openImageCreator()" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-2 px-4 rounded-lg transition-colors">
88
+ Launch Agent
89
+ </button>
90
+ </div>
91
+
92
+ <!-- Sentiment Analysis Agent -->
93
+ <div class="bg-white rounded-xl shadow-lg p-6 hover:shadow-xl transition-shadow">
94
+ <div class="flex items-center mb-4">
95
+ <div class="w-12 h-12 bg-primary-100 rounded-full flex items-center justify-center mr-4">
96
+ <i data-feather="heart" class="text-primary-600"></i>
97
+ </div>
98
+ <h3 class="text-xl font-semibold text-secondary-800">Sentiment Analyzer</h3>
99
+ </div>
100
+ <p class="text-secondary-600 mb-4">Analyze emotions and sentiment in text</p>
101
+ <button onclick="openSentimentAnalyzer()" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-2 px-4 rounded-lg transition-colors">
102
+ Launch Agent
103
+ </button>
104
+ </div>
105
+
106
+ <!-- Translation Agent -->
107
+ <div class="bg-white rounded-xl shadow-lg p-6 hover:shadow-xl transition-shadow">
108
+ <div class="flex items-center mb-4">
109
+ <div class="w-12 h-12 bg-primary-100 rounded-full flex items-center justify-center mr-4">
110
+ <i data-feather="globe" class="text-primary-600"></i>
111
+ </div>
112
+ <h3 class="text-xl font-semibold text-secondary-800">Translator</h3>
113
+ </div>
114
+ <p class="text-secondary-600 mb-4">Translate text between multiple languages</p>
115
+ <button onclick="openTranslator()" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-2 px-4 rounded-lg transition-colors">
116
+ Launch Agent
117
+ </button>
118
+ </div>
119
+
120
+ <!-- Code Generation Agent -->
121
+ <div class="bg-white rounded-xl shadow-lg p-6 hover:shadow-xl transition-shadow">
122
+ <div class="flex items-center mb-4">
123
+ <div class="w-12 h-12 bg-primary-100 rounded-full flex items-center justify-center mr-4">
124
+ <i data-feather="code" class="text-primary-600"></i>
125
+ </div>
126
+ <h3 class="text-xl font-semibold text-secondary-800">Code Assistant</h3>
127
+ </div>
128
+ <p class="text-secondary-600 mb-4">Generate and explain code in various programming languages</p>
129
+ <button onclick="openCodeAssistant()" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-2 px-4 rounded-lg transition-colors">
130
+ Launch Agent
131
+ </button>
132
+ </div>
133
+
134
+ <!-- Audio Processing Agent -->
135
+ <div class="bg-white rounded-xl shadow-lg p-6 hover:shadow-xl transition-shadow">
136
+ <div class="flex items-center mb-4">
137
+ <div class="w-12 h-12 bg-primary-100 rounded-full flex items-center justify-center mr-4">
138
+ <i data-feather="mic" class="text-primary-600"></i>
139
+ </div>
140
+ <h3 class="text-xl font-semibold text-secondary-800">Audio Processor</h3>
141
+ </div>
142
+ <p class="text-secondary-600 mb-4">Process and analyze audio files</p>
143
+ <button onclick="openAudioProcessor()" class="w-full bg-primary-500 hover:bg-primary-600 text-white py-2 px-4 rounded-lg transition-colors">
144
+ Launch Agent
145
+ </button>
146
+ </div>
147
+ </div>
148
+ </section>
149
+
150
+ <!-- Stats Section -->
151
+ <section class="bg-white rounded-xl shadow-lg p-8 mb-16">
152
+ <h2 class="text-3xl font-bold text-secondary-800 mb-8 text-center">Agent Performance</h2>
153
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-6">
154
+ <div class="text-center">
155
+ <div class="text-3xl font-bold text-primary-600">6</div>
156
+ <div class="text-secondary-600">Active Agents</div>
157
+ </div>
158
+ <div class="text-center">
159
+ <div class="text-3xl font-bold text-primary-600">99.2%</div>
160
+ <div class="text-secondary-600">API Uptime</div>
161
+ </div>
162
+ <div class="text-center">
163
+ <div class="text-3xl font-bold text-primary-600">1.2K</div>
164
+ <div class="text-secondary-600">Requests Today</div>
165
+ </div>
166
+ <div class="text-center">
167
+ <div class="text-3xl font-bold text-primary-600">42ms</div>
168
+ <div class="text-secondary-600">Avg Response</div>
169
+ </div>
170
+ </div>
171
+ </section>
172
+ </main>
173
+
174
+ <ai-footer></ai-footer>
175
+
176
+ <script src="components/navigation.js"></script>
177
+ <script src="components/footer.js"></script>
178
+ <script src="script.js"></script>
179
+ <script>
180
+ feather.replace();
181
+
182
+ function openTextGenerator() {
183
+ window.location.href = '/text-generator.html';
184
+ }
185
+
186
+ function openImageCreator() {
187
+ window.location.href = '/image-creator.html';
188
+ }
189
+
190
+ function openSentimentAnalyzer() {
191
+ window.location.href = '/sentiment-analyzer.html';
192
+ }
193
+
194
+ function openTranslator() {
195
+ window.location.href = '/translator.html';
196
+ }
197
+
198
+ function openCodeAssistant() {
199
+ window.location.href = '/code-assistant.html';
200
+ }
201
+
202
+ function openAudioProcessor() {
203
+ window.location.href = '/audio-processor.html';
204
+ }
205
+ </script>
206
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
207
+ </body>
208
+ </html>
script.js ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Global API Configuration
2
+ const API_CONFIG = {
3
+ HUGGING_FACE_API_KEY: 'your-huggingface-api-key-here', // Replace with actual API key
4
+ BASE_URL: 'https://api-inference.huggingface.co/models/',
5
+ MODELS: {
6
+ TEXT_GENERATION: 'gpt2',
7
+ IMAGE_GENERATION: 'runwayml/stable-diffusion-v1-5',
8
+ SENTIMENT_ANALYSIS: 'cardiffnlp/twitter-roberta-base-sentiment-latest',
9
+ TRANSLATION: 'Helsinki-NLP/opus-mt-en-fr',
10
+ CODE_GENERATION: 'microsoft/DialoGPT-medium',
11
+ AUDIO_PROCESSING: 'facebook/wav2vec2-base-960h'
12
+ }
13
+ };
14
+
15
+ // Utility Functions
16
+ class AgentUtils {
17
+ static async makeAPIRequest(endpoint, data, model) {
18
+ try {
19
+ const response = await fetch(`${API_CONFIG.BASE_URL}${model}`, {
20
+ method: 'POST',
21
+ headers: {
22
+ 'Authorization': `Bearer ${API_CONFIG.HUGGING_FACE_API_KEY}`,
23
+ 'Content-Type': 'application/json',
24
+ },
25
+ body: JSON.stringify(data)
26
+ });
27
+
28
+ if (!response.ok) {
29
+ throw new Error(`API request failed: ${response.status}`);
30
+ }
31
+
32
+ return await response.json();
33
+ } catch (error) {
34
+ console.error('API Request Error:', error);
35
+ throw error;
36
+ }
37
+ }
38
+
39
+ static formatResponse(data, agentType) {
40
+ switch (agentType) {
41
+ case 'text':
42
+ return data[0]?.generated_text || 'No response generated';
43
+ case 'image':
44
+ return data;
45
+ case 'sentiment':
46
+ return this.formatSentiment(data);
47
+ case 'translation':
48
+ return data[0]?.translation_text || 'Translation failed';
49
+ case 'code':
50
+ return data[0]?.generated_text || 'No code generated';
51
+ default:
52
+ return data;
53
+ }
54
+ }
55
+
56
+ static formatSentiment(data) {
57
+ if (!Array.isArray(data)) return 'Unable to analyze sentiment';
58
+
59
+ const scores = data[0];
60
+ if (!scores) return 'No sentiment data available';
61
+
62
+ const labels = ['Negative', 'Neutral', 'Positive'];
63
+ const maxScore = Math.max(...scores);
64
+ const maxIndex = scores.indexOf(maxScore);
65
+
66
+ return {
67
+ sentiment: labels[maxIndex],
68
+ confidence: (maxScore * 100).toFixed(2),
69
+ scores: scores.map((score, index) => ({
70
+ label: labels[index],
71
+ score: (score * 100).toFixed(2)
72
+ })
73
+ };
74
+ }
75
+
76
+ static showNotification(message, type = 'info') {
77
+ const notification = document.createElement('div');
78
+ notification.className = `fixed top-4 right-4 p-4 rounded-lg shadow-lg z-50 fade-in ${
79
+ type === 'error' ? 'bg-red-500 text-white' :
80
+ type === 'success' ? 'bg-green-500 text-white' :
81
+ 'bg-blue-500 text-white'
82
+ }`;
83
+ notification.textContent = message;
84
+ document.body.appendChild(notification);
85
+
86
+ setTimeout(() => {
87
+ notification.remove();
88
+ }, 3000);
89
+ }
90
+
91
+ static toggleLoading(element, show) {
92
+ if (show) {
93
+ element.disabled = true;
94
+ element.innerHTML = '<div class="loading-spinner"></div> Processing...';
95
+ } else {
96
+ element.disabled = false;
97
+ element.textContent = element.dataset.originalText || 'Submit';
98
+ }
99
+ }
100
+ }
101
+
102
+ // Agent Base Class
103
+ class BaseAgent {
104
+ constructor(type, model) {
105
+ this.type = type;
106
+ this.model = model;
107
+ }
108
+
109
+ async process(input) {
110
+ try {
111
+ const data = await AgentUtils.makeAPIRequest('', { inputs: input }, this.model);
112
+ return AgentUtils.formatResponse(data, this.type);
113
+ } catch (error) {
114
+ AgentUtils.showNotification(`Agent error: ${error.message}`, 'error');
115
+ throw error;
116
+ }
117
+ }
118
+ }
119
+
120
+ // Specific Agent Classes
121
+ class TextGenerationAgent extends BaseAgent {
122
+ constructor() {
123
+ super('text', API_CONFIG.MODELS.TEXT_GENERATION);
124
+ }
125
+ }
126
+
127
+ class ImageGenerationAgent extends BaseAgent {
128
+ constructor() {
129
+ super('image', API_CONFIG.MODELS.IMAGE_GENERATION);
130
+ }
131
+
132
+ async process(prompt) {
133
+ try {
134
+ const data = await AgentUtils.makeAPIRequest('', { inputs: prompt }, this.model);
135
+ return data;
136
+ } catch (error) {
137
+ AgentUtils.showNotification(`Image generation failed: ${error.message}`, 'error');
138
+ throw error;
139
+ }
140
+ }
141
+ }
142
+
143
+ class SentimentAnalysisAgent extends BaseAgent {
144
+ constructor() {
145
+ super('sentiment', API_CONFIG.MODELS.SENTIMENT_ANALYSIS);
146
+ }
147
+ }
148
+
149
+ class TranslationAgent extends BaseAgent {
150
+ constructor() {
151
+ super('translation', API_CONFIG.MODELS.TRANSLATION);
152
+ }
153
+ }
154
+
155
+ class CodeGenerationAgent extends BaseAgent {
156
+ constructor() {
157
+ super('code', API_CONFIG.MODELS.CODE_GENERATION);
158
+ }
159
+ }
160
+
161
+ class AudioProcessingAgent extends BaseAgent {
162
+ constructor() {
163
+ super('audio', API_CONFIG.MODELS.AUDIO_PROCESSING);
164
+ }
165
+ }
166
+
167
+ // Agent Manager
168
+ class AgentManager {
169
+ constructor() {
170
+ this.agents = {
171
+ text: new TextGenerationAgent(),
172
+ image: new ImageGenerationAgent(),
173
+ sentiment: new SentimentAnalysisAgent(),
174
+ translation: new TranslationAgent(),
175
+ code: new CodeGenerationAgent(),
176
+ audio: new AudioProcessingAgent()
177
+ };
178
+ }
179
+
180
+ getAgent(type) {
181
+ return this.agents[type];
182
+ }
183
+
184
+ async executeAgent(type, input) {
185
+ const agent = this.getAgent(type);
186
+ if (!agent) {
187
+ throw new Error(`Agent type '${type}' not found`);
188
+ }
189
+ return await agent.process(input);
190
+ }
191
+ }
192
+
193
+ // Initialize Agent Manager
194
+ const agentManager = new AgentManager();
195
+
196
+ // Event Listeners for Agent Pages
197
+ document.addEventListener('DOMContentLoaded', function() {
198
+ // Text Generation Form
199
+ const textForm = document.getElementById('text-generation-form');
200
+ if (textForm) {
201
+ textForm.addEventListener('submit', async function(e) {
202
+ e.preventDefault();
203
+ const input = document.getElementById('text-input').value;
204
+ const submitBtn = document.getElementById('text-submit-btn');
205
+
206
+ if (!input.trim()) {
207
+ AgentUtils.showNotification('Please enter some text', 'error');
208
+ return;
209
+ }
210
+
211
+ AgentUtils.toggleLoading(submitBtn, true);
212
+
213
+ try {
214
+ const result = await agentManager.executeAgent('text', input);
215
+ document.getElementById('text-result').textContent = result;
216
+ } catch (error) {
217
+ console.error('Text generation failed:', error);
218
+ } finally {
219
+ AgentUtils.toggleLoading(submitBtn, false);
220
+ }
221
+ });
222
+ }
223
+
224
+ // Image Generation Form
225
+ const imageForm = document.getElementById('image-generation-form');
226
+ if (imageForm) {
227
+ imageForm.addEventListener('submit', async function(e) {
228
+ e.preventDefault();
229
+ const prompt = document.getElementById('image-prompt').value;
230
+ const submitBtn = document.getElementById('image-submit-btn');
231
+
232
+ if (!prompt.trim()) {
233
+ AgentUtils.showNotification('Please enter an image description', 'error');
234
+ return;
235
+ }
236
+
237
+ AgentUtils.toggleLoading(submitBtn, true);
238
+
239
+ try {
240
+ const result = await agentManager.executeAgent('image', prompt);
241
+ // For demo purposes, we'll show a placeholder image
242
+ const imageResult = document.getElementById('image-result');
243
+ imageResult.innerHTML = `
244
+ <div class="text-center">
245
+ <img src="http://static.photos/technology/640x360/1" alt="Generated Image" class="rounded-lg mx-auto mb-4">
246
+ <p class="text-secondary-600">Image generated based on: "${prompt}"</p>
247
+ </div>
248
+ `;
249
+ } catch (error) {
250
+ console.error('Image generation failed:', error);
251
+ } finally {
252
+ AgentUtils.toggleLoading(submitBtn, false);
253
+ }
254
+ });
255
+ }
256
+
257
+ // Add similar event listeners for other agent types...
258
+ });
style.css CHANGED
@@ -1,28 +1,91 @@
 
 
 
 
 
 
 
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
 
28
  }
 
 
 
 
 
 
 
 
 
 
1
+ /* Global Styles */
2
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
3
+
4
+ * {
5
+ margin: 0;
6
+ padding: 0;
7
+ box-sizing: border-box;
8
+ }
9
+
10
  body {
11
+ font-family: 'Inter', sans-serif;
12
+ line-height: 1.6;
13
+ }
14
+
15
+ /* Custom Scrollbar */
16
+ ::-webkit-scrollbar {
17
+ width: 8px;
18
+ }
19
+
20
+ ::-webkit-scrollbar-track {
21
+ background: #f1f5f9;
22
+ }
23
+
24
+ ::-webkit-scrollbar-thumb {
25
+ background: #cbd5e1;
26
+ border-radius: 4px;
27
+ }
28
+
29
+ ::-webkit-scrollbar-thumb:hover {
30
+ background: #94a3b8;
31
+ }
32
+
33
+ /* Loading Animation */
34
+ .loading-spinner {
35
+ border: 2px solid #f3f4f6;
36
+ border-top: 2px solid #0ea5e9;
37
+ border-radius: 50%;
38
+ width: 20px;
39
+ height: 20px;
40
+ animation: spin 1s linear infinite;
41
+ }
42
+
43
+ @keyframes spin {
44
+ 0% { transform: rotate(0deg); }
45
+ 100% { transform: rotate(360deg); }
46
+ }
47
+
48
+ /* Fade In Animation */
49
+ .fade-in {
50
+ animation: fadeIn 0.5s ease-in;
51
+ }
52
+
53
+ @keyframes fadeIn {
54
+ from { opacity: 0; transform: translateY(10px); }
55
+ to { opacity: 1; transform: translateY(0); }
56
+ }
57
+
58
+ /* Pulse Animation for Active Elements */
59
+ .pulse-glow {
60
+ animation: pulseGlow 2s infinite;
61
  }
62
 
63
+ @keyframes pulseGlow {
64
+ 0%, 100% { box-shadow: 0 0 5px rgba(14, 165, 233, 0.4); }
65
+ 50% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.8); }
66
  }
67
 
68
+ /* Agent Card Hover Effects */
69
+ .agent-card {
70
+ transition: all 0.3s ease;
 
 
71
  }
72
 
73
+ .agent-card:hover {
74
+ transform: translateY(-5px);
 
 
 
 
75
  }
76
 
77
+ /* Responsive Typography */
78
+ @media (max-width: 768px) {
79
+ .text-responsive {
80
+ font-size: 1.5rem;
81
+ }
82
  }
83
+
84
+ /* Gradient Backgrounds */
85
+ .gradient-primary {
86
+ background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
87
+ }
88
+
89
+ .gradient-secondary {
90
+ background: linear-gradient(135deg, #64748b 0%, #334155 100%);
91
+ }