Spaces:
Runtime error
Runtime error
added extra prompts, gradio and mock_tools
Browse files- .venv/lib/python3.12/site-packages/gradio/_frontend_code/lite/src/theme.css +563 -0
- .venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/backend/gradio_test/__pycache__/__init__.cpython-312.pyc +0 -0
- .venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/backend/gradio_test/__pycache__/test.cpython-312.pyc +0 -0
- .venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/demo/__pycache__/__init__.cpython-312.pyc +0 -0
- .venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/demo/__pycache__/app.cpython-312.pyc +0 -0
- Gradio_UI.py +97 -0
- prompts.yaml +109 -57
- tools/mock_tools.py +81 -0
.venv/lib/python3.12/site-packages/gradio/_frontend_code/lite/src/theme.css
ADDED
|
@@ -0,0 +1,563 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
@font-face {
|
| 3 |
+
font-family: 'ui-sans-serif';
|
| 4 |
+
src: url('static/fonts/ui-sans-serif/ui-sans-serif-Regular.woff2') format('woff2');
|
| 5 |
+
font-weight: Regular;
|
| 6 |
+
font-style: normal;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
@font-face {
|
| 11 |
+
font-family: 'ui-sans-serif';
|
| 12 |
+
src: url('static/fonts/ui-sans-serif/ui-sans-serif-Bold.woff2') format('woff2');
|
| 13 |
+
font-weight: Bold;
|
| 14 |
+
font-style: normal;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
@font-face {
|
| 19 |
+
font-family: 'system-ui';
|
| 20 |
+
src: url('static/fonts/system-ui/system-ui-Regular.woff2') format('woff2');
|
| 21 |
+
font-weight: Regular;
|
| 22 |
+
font-style: normal;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@font-face {
|
| 27 |
+
font-family: 'system-ui';
|
| 28 |
+
src: url('static/fonts/system-ui/system-ui-Bold.woff2') format('woff2');
|
| 29 |
+
font-weight: Bold;
|
| 30 |
+
font-style: normal;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
@font-face {
|
| 35 |
+
font-family: 'sans-serif';
|
| 36 |
+
src: url('static/fonts/sans-serif/sans-serif-Regular.woff2') format('woff2');
|
| 37 |
+
font-weight: Regular;
|
| 38 |
+
font-style: normal;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@font-face {
|
| 43 |
+
font-family: 'sans-serif';
|
| 44 |
+
src: url('static/fonts/sans-serif/sans-serif-Bold.woff2') format('woff2');
|
| 45 |
+
font-weight: Bold;
|
| 46 |
+
font-style: normal;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
@font-face {
|
| 51 |
+
font-family: 'IBM Plex Mono';
|
| 52 |
+
src: url('static/fonts/IBMPlexMono/IBMPlexMono-Regular.woff2') format('woff2');
|
| 53 |
+
font-weight: Regular;
|
| 54 |
+
font-style: normal;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
@font-face {
|
| 59 |
+
font-family: 'IBM Plex Mono';
|
| 60 |
+
src: url('static/fonts/IBMPlexMono/IBMPlexMono-Bold.woff2') format('woff2');
|
| 61 |
+
font-weight: Bold;
|
| 62 |
+
font-style: normal;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
@font-face {
|
| 67 |
+
font-family: 'ui-monospace';
|
| 68 |
+
src: url('static/fonts/ui-monospace/ui-monospace-Regular.woff2') format('woff2');
|
| 69 |
+
font-weight: Regular;
|
| 70 |
+
font-style: normal;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
@font-face {
|
| 75 |
+
font-family: 'ui-monospace';
|
| 76 |
+
src: url('static/fonts/ui-monospace/ui-monospace-Bold.woff2') format('woff2');
|
| 77 |
+
font-weight: Bold;
|
| 78 |
+
font-style: normal;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
@font-face {
|
| 83 |
+
font-family: 'Consolas';
|
| 84 |
+
src: url('static/fonts/Consolas/Consolas-Regular.woff2') format('woff2');
|
| 85 |
+
font-weight: Regular;
|
| 86 |
+
font-style: normal;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
@font-face {
|
| 91 |
+
font-family: 'Consolas';
|
| 92 |
+
src: url('static/fonts/Consolas/Consolas-Bold.woff2') format('woff2');
|
| 93 |
+
font-weight: Bold;
|
| 94 |
+
font-style: normal;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
@font-face {
|
| 99 |
+
font-family: 'monospace';
|
| 100 |
+
src: url('static/fonts/monospace/monospace-Regular.woff2') format('woff2');
|
| 101 |
+
font-weight: Regular;
|
| 102 |
+
font-style: normal;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
@font-face {
|
| 107 |
+
font-family: 'monospace';
|
| 108 |
+
src: url('static/fonts/monospace/monospace-Bold.woff2') format('woff2');
|
| 109 |
+
font-weight: Bold;
|
| 110 |
+
font-style: normal;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
:root {
|
| 114 |
+
--name: default;
|
| 115 |
+
--primary-50: #fff7ed;
|
| 116 |
+
--primary-100: #ffedd5;
|
| 117 |
+
--primary-200: #ffddb3;
|
| 118 |
+
--primary-300: #fdba74;
|
| 119 |
+
--primary-400: #fb923c;
|
| 120 |
+
--primary-500: #f97316;
|
| 121 |
+
--primary-600: #ea580c;
|
| 122 |
+
--primary-700: #c2410c;
|
| 123 |
+
--primary-800: #9a3412;
|
| 124 |
+
--primary-900: #7c2d12;
|
| 125 |
+
--primary-950: #6c2e12;
|
| 126 |
+
--secondary-50: #eff6ff;
|
| 127 |
+
--secondary-100: #dbeafe;
|
| 128 |
+
--secondary-200: #bfdbfe;
|
| 129 |
+
--secondary-300: #93c5fd;
|
| 130 |
+
--secondary-400: #60a5fa;
|
| 131 |
+
--secondary-500: #3b82f6;
|
| 132 |
+
--secondary-600: #2563eb;
|
| 133 |
+
--secondary-700: #1d4ed8;
|
| 134 |
+
--secondary-800: #1e40af;
|
| 135 |
+
--secondary-900: #1e3a8a;
|
| 136 |
+
--secondary-950: #1d3660;
|
| 137 |
+
--neutral-50: #fafafa;
|
| 138 |
+
--neutral-100: #f4f4f5;
|
| 139 |
+
--neutral-200: #e4e4e7;
|
| 140 |
+
--neutral-300: #d4d4d8;
|
| 141 |
+
--neutral-400: #bbbbc2;
|
| 142 |
+
--neutral-500: #71717a;
|
| 143 |
+
--neutral-600: #52525b;
|
| 144 |
+
--neutral-700: #3f3f46;
|
| 145 |
+
--neutral-800: #27272a;
|
| 146 |
+
--neutral-900: #18181b;
|
| 147 |
+
--neutral-950: #0f0f11;
|
| 148 |
+
--spacing-xxs: 1px;
|
| 149 |
+
--spacing-xs: 2px;
|
| 150 |
+
--spacing-sm: 4px;
|
| 151 |
+
--spacing-md: 6px;
|
| 152 |
+
--spacing-lg: 8px;
|
| 153 |
+
--spacing-xl: 10px;
|
| 154 |
+
--spacing-xxl: 16px;
|
| 155 |
+
--radius-xxs: 1px;
|
| 156 |
+
--radius-xs: 2px;
|
| 157 |
+
--radius-sm: 4px;
|
| 158 |
+
--radius-md: 6px;
|
| 159 |
+
--radius-lg: 8px;
|
| 160 |
+
--radius-xl: 12px;
|
| 161 |
+
--radius-xxl: 22px;
|
| 162 |
+
--text-xxs: 9px;
|
| 163 |
+
--text-xs: 10px;
|
| 164 |
+
--text-sm: 12px;
|
| 165 |
+
--text-md: 14px;
|
| 166 |
+
--text-lg: 16px;
|
| 167 |
+
--text-xl: 22px;
|
| 168 |
+
--text-xxl: 26px;
|
| 169 |
+
--font: 'Source Sans Pro', 'ui-sans-serif', 'system-ui', sans-serif;
|
| 170 |
+
--font-mono: 'IBM Plex Mono', 'ui-monospace', 'Consolas', monospace;
|
| 171 |
+
--body-background-fill: var(--background-fill-primary);
|
| 172 |
+
--body-text-color: var(--neutral-800);
|
| 173 |
+
--body-text-size: var(--text-md);
|
| 174 |
+
--body-text-weight: 400;
|
| 175 |
+
--embed-radius: var(--radius-sm);
|
| 176 |
+
--color-accent: var(--primary-500);
|
| 177 |
+
--color-accent-soft: var(--primary-50);
|
| 178 |
+
--background-fill-primary: white;
|
| 179 |
+
--background-fill-secondary: var(--neutral-50);
|
| 180 |
+
--border-color-accent: var(--primary-300);
|
| 181 |
+
--border-color-primary: var(--neutral-200);
|
| 182 |
+
--link-text-color: var(--secondary-600);
|
| 183 |
+
--link-text-color-active: var(--secondary-600);
|
| 184 |
+
--link-text-color-hover: var(--secondary-700);
|
| 185 |
+
--link-text-color-visited: var(--secondary-500);
|
| 186 |
+
--body-text-color-subdued: var(--neutral-400);
|
| 187 |
+
--accordion-text-color: var(--body-text-color);
|
| 188 |
+
--table-text-color: var(--body-text-color);
|
| 189 |
+
--shadow-drop: rgba(0,0,0,0.05) 0px 1px 2px 0px;
|
| 190 |
+
--shadow-drop-lg: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
| 191 |
+
--shadow-inset: rgba(0,0,0,0.05) 0px 2px 4px 0px inset;
|
| 192 |
+
--shadow-spread: 3px;
|
| 193 |
+
--block-background-fill: var(--background-fill-primary);
|
| 194 |
+
--block-border-color: var(--border-color-primary);
|
| 195 |
+
--block-border-width: 1px;
|
| 196 |
+
--block-info-text-color: var(--body-text-color-subdued);
|
| 197 |
+
--block-info-text-size: var(--text-sm);
|
| 198 |
+
--block-info-text-weight: 400;
|
| 199 |
+
--block-label-background-fill: var(--background-fill-primary);
|
| 200 |
+
--block-label-border-color: var(--border-color-primary);
|
| 201 |
+
--block-label-border-width: 1px;
|
| 202 |
+
--block-label-shadow: var(--block-shadow);
|
| 203 |
+
--block-label-text-color: var(--neutral-500);
|
| 204 |
+
--block-label-margin: 0;
|
| 205 |
+
--block-label-padding: var(--spacing-sm) var(--spacing-lg);
|
| 206 |
+
--block-label-radius: calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px) 0;
|
| 207 |
+
--block-label-right-radius: 0 calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px);
|
| 208 |
+
--block-label-text-size: var(--text-sm);
|
| 209 |
+
--block-label-text-weight: 400;
|
| 210 |
+
--block-padding: var(--spacing-xl) calc(var(--spacing-xl) + 2px);
|
| 211 |
+
--block-radius: var(--radius-sm);
|
| 212 |
+
--block-shadow: none;
|
| 213 |
+
--block-title-background-fill: none;
|
| 214 |
+
--block-title-border-color: none;
|
| 215 |
+
--block-title-border-width: 0px;
|
| 216 |
+
--block-title-text-color: var(--neutral-500);
|
| 217 |
+
--block-title-padding: 0;
|
| 218 |
+
--block-title-radius: none;
|
| 219 |
+
--block-title-text-size: var(--text-md);
|
| 220 |
+
--block-title-text-weight: 400;
|
| 221 |
+
--container-radius: var(--radius-sm);
|
| 222 |
+
--form-gap-width: 0px;
|
| 223 |
+
--layout-gap: var(--spacing-xxl);
|
| 224 |
+
--panel-background-fill: var(--background-fill-secondary);
|
| 225 |
+
--panel-border-color: var(--border-color-primary);
|
| 226 |
+
--panel-border-width: 0;
|
| 227 |
+
--section-header-text-size: var(--text-md);
|
| 228 |
+
--section-header-text-weight: 400;
|
| 229 |
+
--border-color-accent-subdued: var(--primary-200);
|
| 230 |
+
--code-background-fill: var(--neutral-100);
|
| 231 |
+
--chatbot-text-size: var(--text-lg);
|
| 232 |
+
--checkbox-background-color: var(--background-fill-primary);
|
| 233 |
+
--checkbox-background-color-focus: var(--checkbox-background-color);
|
| 234 |
+
--checkbox-background-color-hover: var(--checkbox-background-color);
|
| 235 |
+
--checkbox-background-color-selected: var(--color-accent);
|
| 236 |
+
--checkbox-border-color: var(--neutral-300);
|
| 237 |
+
--checkbox-border-color-focus: var(--color-accent);
|
| 238 |
+
--checkbox-border-color-hover: var(--neutral-300);
|
| 239 |
+
--checkbox-border-color-selected: var(--color-accent);
|
| 240 |
+
--checkbox-border-radius: var(--radius-sm);
|
| 241 |
+
--checkbox-border-width: var(--input-border-width);
|
| 242 |
+
--checkbox-label-background-fill: var(--background-fill-primary);
|
| 243 |
+
--checkbox-label-background-fill-hover: var(--background-fill-secondary);
|
| 244 |
+
--checkbox-label-background-fill-selected: var(--checkbox-label-background-fill);
|
| 245 |
+
--checkbox-label-border-color: var(--border-color-primary);
|
| 246 |
+
--checkbox-label-border-color-hover: var(--checkbox-label-border-color);
|
| 247 |
+
--checkbox-label-border-color-selected: var(--checkbox-label-border-color);
|
| 248 |
+
--checkbox-label-border-width: var(--input-border-width);
|
| 249 |
+
--checkbox-label-gap: var(--spacing-lg);
|
| 250 |
+
--checkbox-label-padding: var(--spacing-md) calc(2 * var(--spacing-md));
|
| 251 |
+
--checkbox-label-shadow: none;
|
| 252 |
+
--checkbox-label-text-size: var(--text-md);
|
| 253 |
+
--checkbox-label-text-weight: 400;
|
| 254 |
+
--checkbox-check: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
|
| 255 |
+
--radio-circle: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
|
| 256 |
+
--checkbox-shadow: var(--input-shadow);
|
| 257 |
+
--checkbox-label-text-color: var(--body-text-color);
|
| 258 |
+
--checkbox-label-text-color-selected: var(--checkbox-label-text-color);
|
| 259 |
+
--error-background-fill: #fef2f2;
|
| 260 |
+
--error-border-color: #b91c1c;
|
| 261 |
+
--error-border-width: 1px;
|
| 262 |
+
--error-text-color: #b91c1c;
|
| 263 |
+
--error-icon-color: #b91c1c;
|
| 264 |
+
--input-background-fill: white;
|
| 265 |
+
--input-background-fill-focus: var(--input-background-fill);
|
| 266 |
+
--input-background-fill-hover: var(--input-background-fill);
|
| 267 |
+
--input-border-color: var(--border-color-primary);
|
| 268 |
+
--input-border-color-focus: var(--secondary-300);
|
| 269 |
+
--input-border-color-hover: var(--input-border-color);
|
| 270 |
+
--input-border-width: 1px;
|
| 271 |
+
--input-padding: var(--spacing-xl);
|
| 272 |
+
--input-placeholder-color: var(--neutral-400);
|
| 273 |
+
--input-radius: var(--radius-sm);
|
| 274 |
+
--input-shadow: none;
|
| 275 |
+
--input-shadow-focus: 0 0 0 var(--shadow-spread) var(--secondary-50), var(--shadow-inset);
|
| 276 |
+
--input-text-size: var(--text-md);
|
| 277 |
+
--input-text-weight: 400;
|
| 278 |
+
--loader-color: var(--color-accent);
|
| 279 |
+
--prose-text-size: var(--text-md);
|
| 280 |
+
--prose-text-weight: 400;
|
| 281 |
+
--prose-header-text-weight: 600;
|
| 282 |
+
--slider-color: var(--color-accent);
|
| 283 |
+
--stat-background-fill: linear-gradient(to right, var(--primary-400), var(--primary-200));
|
| 284 |
+
--table-border-color: var(--neutral-300);
|
| 285 |
+
--table-even-background-fill: white;
|
| 286 |
+
--table-odd-background-fill: var(--neutral-50);
|
| 287 |
+
--table-radius: var(--radius-sm);
|
| 288 |
+
--table-row-focus: var(--color-accent-soft);
|
| 289 |
+
--button-border-width: 0px;
|
| 290 |
+
--button-cancel-background-fill: #ef4444;
|
| 291 |
+
--button-cancel-background-fill-hover: #dc2626;
|
| 292 |
+
--button-cancel-border-color: var(--button-secondary-border-color);
|
| 293 |
+
--button-cancel-border-color-hover: var(--button-secondary-border-color-hover);
|
| 294 |
+
--button-cancel-text-color: white;
|
| 295 |
+
--button-cancel-text-color-hover: white;
|
| 296 |
+
--button-transform-hover: none;
|
| 297 |
+
--button-transform-active: none;
|
| 298 |
+
--button-transition: all 0.2s ease;
|
| 299 |
+
--button-large-padding: var(--spacing-lg) calc(2 * var(--spacing-lg));
|
| 300 |
+
--button-large-radius: var(--radius-md);
|
| 301 |
+
--button-large-text-size: var(--text-lg);
|
| 302 |
+
--button-large-text-weight: 600;
|
| 303 |
+
--button-primary-background-fill: var(--primary-500);
|
| 304 |
+
--button-primary-background-fill-hover: var(--primary-600);
|
| 305 |
+
--button-primary-border-color: var(--primary-500);
|
| 306 |
+
--button-primary-border-color-hover: var(--primary-500);
|
| 307 |
+
--button-primary-text-color: white;
|
| 308 |
+
--button-primary-text-color-hover: var(--button-primary-text-color);
|
| 309 |
+
--button-primary-shadow: none;
|
| 310 |
+
--button-primary-shadow-hover: var(--button-primary-shadow);
|
| 311 |
+
--button-primary-shadow-active: var(--button-primary-shadow);
|
| 312 |
+
--button-secondary-background-fill: var(--neutral-200);
|
| 313 |
+
--button-secondary-background-fill-hover: var(--neutral-300);
|
| 314 |
+
--button-secondary-border-color: var(--neutral-200);
|
| 315 |
+
--button-secondary-border-color-hover: var(--neutral-200);
|
| 316 |
+
--button-secondary-text-color: black;
|
| 317 |
+
--button-secondary-text-color-hover: var(--button-secondary-text-color);
|
| 318 |
+
--button-secondary-shadow: var(--button-primary-shadow);
|
| 319 |
+
--button-secondary-shadow-hover: var(--button-secondary-shadow);
|
| 320 |
+
--button-secondary-shadow-active: var(--button-secondary-shadow);
|
| 321 |
+
--button-small-padding: var(--spacing-sm) calc(1.5 * var(--spacing-sm));
|
| 322 |
+
--button-small-radius: var(--radius-md);
|
| 323 |
+
--button-small-text-size: var(--text-sm);
|
| 324 |
+
--button-small-text-weight: 400;
|
| 325 |
+
--button-medium-padding: var(--spacing-md) calc(2 * var(--spacing-md));
|
| 326 |
+
--button-medium-radius: var(--radius-md);
|
| 327 |
+
--button-medium-text-size: var(--text-md);
|
| 328 |
+
--button-medium-text-weight: 600;
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
:root .dark {
|
| 332 |
+
--body-background-fill: var(--background-fill-primary);
|
| 333 |
+
--body-text-color: var(--neutral-100);
|
| 334 |
+
--color-accent-soft: var(--neutral-700);
|
| 335 |
+
--background-fill-primary: var(--neutral-950);
|
| 336 |
+
--background-fill-secondary: var(--neutral-900);
|
| 337 |
+
--border-color-accent: var(--neutral-600);
|
| 338 |
+
--border-color-primary: var(--neutral-700);
|
| 339 |
+
--link-text-color-active: var(--secondary-500);
|
| 340 |
+
--link-text-color: var(--secondary-500);
|
| 341 |
+
--link-text-color-hover: var(--secondary-400);
|
| 342 |
+
--link-text-color-visited: var(--secondary-600);
|
| 343 |
+
--body-text-color-subdued: var(--neutral-400);
|
| 344 |
+
--accordion-text-color: var(--body-text-color);
|
| 345 |
+
--table-text-color: var(--body-text-color);
|
| 346 |
+
--shadow-spread: 1px;
|
| 347 |
+
--block-background-fill: var(--neutral-800);
|
| 348 |
+
--block-border-color: var(--border-color-primary);
|
| 349 |
+
--block_border_width: None;
|
| 350 |
+
--block-info-text-color: var(--body-text-color-subdued);
|
| 351 |
+
--block-label-background-fill: var(--background-fill-secondary);
|
| 352 |
+
--block-label-border-color: var(--border-color-primary);
|
| 353 |
+
--block_label_border_width: None;
|
| 354 |
+
--block-label-text-color: var(--neutral-200);
|
| 355 |
+
--block_shadow: None;
|
| 356 |
+
--block_title_background_fill: None;
|
| 357 |
+
--block_title_border_color: None;
|
| 358 |
+
--block_title_border_width: None;
|
| 359 |
+
--block-title-text-color: var(--neutral-200);
|
| 360 |
+
--panel-background-fill: var(--background-fill-secondary);
|
| 361 |
+
--panel-border-color: var(--border-color-primary);
|
| 362 |
+
--panel_border_width: None;
|
| 363 |
+
--border-color-accent-subdued: var(--border-color-accent);
|
| 364 |
+
--code-background-fill: var(--neutral-800);
|
| 365 |
+
--checkbox-background-color: var(--neutral-800);
|
| 366 |
+
--checkbox-background-color-focus: var(--checkbox-background-color);
|
| 367 |
+
--checkbox-background-color-hover: var(--checkbox-background-color);
|
| 368 |
+
--checkbox-background-color-selected: var(--color-accent);
|
| 369 |
+
--checkbox-border-color: var(--neutral-700);
|
| 370 |
+
--checkbox-border-color-focus: var(--color-accent);
|
| 371 |
+
--checkbox-border-color-hover: var(--neutral-600);
|
| 372 |
+
--checkbox-border-color-selected: var(--color-accent);
|
| 373 |
+
--checkbox-border-width: var(--input-border-width);
|
| 374 |
+
--checkbox-label-background-fill: var(--neutral-800);
|
| 375 |
+
--checkbox-label-background-fill-hover: var(--checkbox-label-background-fill);
|
| 376 |
+
--checkbox-label-background-fill-selected: var(--checkbox-label-background-fill);
|
| 377 |
+
--checkbox-label-border-color: var(--border-color-primary);
|
| 378 |
+
--checkbox-label-border-color-hover: var(--checkbox-label-border-color);
|
| 379 |
+
--checkbox-label-border-color-selected: var(--checkbox-label-border-color);
|
| 380 |
+
--checkbox-label-border-width: var(--input-border-width);
|
| 381 |
+
--checkbox-label-text-color: var(--body-text-color);
|
| 382 |
+
--checkbox-label-text-color-selected: var(--checkbox-label-text-color);
|
| 383 |
+
--error-background-fill: var(--neutral-900);
|
| 384 |
+
--error-border-color: #ef4444;
|
| 385 |
+
--error_border_width: None;
|
| 386 |
+
--error-text-color: #fef2f2;
|
| 387 |
+
--error-icon-color: #ef4444;
|
| 388 |
+
--input-background-fill: var(--neutral-800);
|
| 389 |
+
--input_background_fill_focus: None;
|
| 390 |
+
--input-background-fill-hover: var(--input-background-fill);
|
| 391 |
+
--input-border-color: var(--border-color-primary);
|
| 392 |
+
--input-border-color-focus: var(--neutral-700);
|
| 393 |
+
--input-border-color-hover: var(--input-border-color);
|
| 394 |
+
--input_border_width: None;
|
| 395 |
+
--input-placeholder-color: var(--neutral-500);
|
| 396 |
+
--input_shadow: None;
|
| 397 |
+
--input-shadow-focus: 0 0 0 var(--shadow-spread) var(--neutral-700), var(--shadow-inset);
|
| 398 |
+
--loader_color: None;
|
| 399 |
+
--slider_color: None;
|
| 400 |
+
--stat-background-fill: linear-gradient(to right, var(--primary-400), var(--primary-600));
|
| 401 |
+
--table-border-color: var(--neutral-700);
|
| 402 |
+
--table-even-background-fill: var(--neutral-950);
|
| 403 |
+
--table-odd-background-fill: var(--neutral-900);
|
| 404 |
+
--table-row-focus: var(--color-accent-soft);
|
| 405 |
+
--button_border_width: None;
|
| 406 |
+
--button-cancel-background-fill: #b91c1c;
|
| 407 |
+
--button-cancel-background-fill-hover: #991b1b;
|
| 408 |
+
--button-cancel-border-color: var(--button-secondary-border-color);
|
| 409 |
+
--button-cancel-border-color-hover: var(--button-secondary-border-color-hover);
|
| 410 |
+
--button-cancel-text-color: white;
|
| 411 |
+
--button-cancel-text-color-hover: white;
|
| 412 |
+
--button-primary-background-fill: var(--primary-600);
|
| 413 |
+
--button-primary-background-fill-hover: var(--primary-700);
|
| 414 |
+
--button-primary-border-color: var(--primary-600);
|
| 415 |
+
--button-primary-border-color-hover: var(--primary-500);
|
| 416 |
+
--button-primary-text-color: white;
|
| 417 |
+
--button-primary-text-color-hover: var(--button-primary-text-color);
|
| 418 |
+
--button_primary_shadow: None;
|
| 419 |
+
--button-primary-shadow-hover: var(--button-primary-shadow);
|
| 420 |
+
--button-primary-shadow-active: var(--button-primary-shadow);
|
| 421 |
+
--button-secondary-background-fill: var(--neutral-600);
|
| 422 |
+
--button-secondary-background-fill-hover: var(--neutral-700);
|
| 423 |
+
--button-secondary-border-color: var(--neutral-600);
|
| 424 |
+
--button-secondary-border-color-hover: var(--neutral-500);
|
| 425 |
+
--button-secondary-text-color: white;
|
| 426 |
+
--button-secondary-text-color-hover: var(--button-secondary-text-color);
|
| 427 |
+
--button_secondary_shadow: None;
|
| 428 |
+
--button-secondary-shadow-hover: var(--button-secondary-shadow);
|
| 429 |
+
--button-secondary-shadow-active: var(--button-secondary-shadow);
|
| 430 |
+
--name: default;
|
| 431 |
+
--primary-50: #fff7ed;
|
| 432 |
+
--primary-100: #ffedd5;
|
| 433 |
+
--primary-200: #ffddb3;
|
| 434 |
+
--primary-300: #fdba74;
|
| 435 |
+
--primary-400: #fb923c;
|
| 436 |
+
--primary-500: #f97316;
|
| 437 |
+
--primary-600: #ea580c;
|
| 438 |
+
--primary-700: #c2410c;
|
| 439 |
+
--primary-800: #9a3412;
|
| 440 |
+
--primary-900: #7c2d12;
|
| 441 |
+
--primary-950: #6c2e12;
|
| 442 |
+
--secondary-50: #eff6ff;
|
| 443 |
+
--secondary-100: #dbeafe;
|
| 444 |
+
--secondary-200: #bfdbfe;
|
| 445 |
+
--secondary-300: #93c5fd;
|
| 446 |
+
--secondary-400: #60a5fa;
|
| 447 |
+
--secondary-500: #3b82f6;
|
| 448 |
+
--secondary-600: #2563eb;
|
| 449 |
+
--secondary-700: #1d4ed8;
|
| 450 |
+
--secondary-800: #1e40af;
|
| 451 |
+
--secondary-900: #1e3a8a;
|
| 452 |
+
--secondary-950: #1d3660;
|
| 453 |
+
--neutral-50: #fafafa;
|
| 454 |
+
--neutral-100: #f4f4f5;
|
| 455 |
+
--neutral-200: #e4e4e7;
|
| 456 |
+
--neutral-300: #d4d4d8;
|
| 457 |
+
--neutral-400: #bbbbc2;
|
| 458 |
+
--neutral-500: #71717a;
|
| 459 |
+
--neutral-600: #52525b;
|
| 460 |
+
--neutral-700: #3f3f46;
|
| 461 |
+
--neutral-800: #27272a;
|
| 462 |
+
--neutral-900: #18181b;
|
| 463 |
+
--neutral-950: #0f0f11;
|
| 464 |
+
--spacing-xxs: 1px;
|
| 465 |
+
--spacing-xs: 2px;
|
| 466 |
+
--spacing-sm: 4px;
|
| 467 |
+
--spacing-md: 6px;
|
| 468 |
+
--spacing-lg: 8px;
|
| 469 |
+
--spacing-xl: 10px;
|
| 470 |
+
--spacing-xxl: 16px;
|
| 471 |
+
--radius-xxs: 1px;
|
| 472 |
+
--radius-xs: 2px;
|
| 473 |
+
--radius-sm: 4px;
|
| 474 |
+
--radius-md: 6px;
|
| 475 |
+
--radius-lg: 8px;
|
| 476 |
+
--radius-xl: 12px;
|
| 477 |
+
--radius-xxl: 22px;
|
| 478 |
+
--text-xxs: 9px;
|
| 479 |
+
--text-xs: 10px;
|
| 480 |
+
--text-sm: 12px;
|
| 481 |
+
--text-md: 14px;
|
| 482 |
+
--text-lg: 16px;
|
| 483 |
+
--text-xl: 22px;
|
| 484 |
+
--text-xxl: 26px;
|
| 485 |
+
--font: 'Source Sans Pro', 'ui-sans-serif', 'system-ui', sans-serif;
|
| 486 |
+
--font-mono: 'IBM Plex Mono', 'ui-monospace', 'Consolas', monospace;
|
| 487 |
+
--body-text-size: var(--text-md);
|
| 488 |
+
--body-text-weight: 400;
|
| 489 |
+
--embed-radius: var(--radius-sm);
|
| 490 |
+
--color-accent: var(--primary-500);
|
| 491 |
+
--shadow-drop: rgba(0,0,0,0.05) 0px 1px 2px 0px;
|
| 492 |
+
--shadow-drop-lg: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
|
| 493 |
+
--shadow-inset: rgba(0,0,0,0.05) 0px 2px 4px 0px inset;
|
| 494 |
+
--block-border-width: 1px;
|
| 495 |
+
--block-info-text-size: var(--text-sm);
|
| 496 |
+
--block-info-text-weight: 400;
|
| 497 |
+
--block-label-border-width: 1px;
|
| 498 |
+
--block-label-shadow: var(--block-shadow);
|
| 499 |
+
--block-label-margin: 0;
|
| 500 |
+
--block-label-padding: var(--spacing-sm) var(--spacing-lg);
|
| 501 |
+
--block-label-radius: calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px) 0;
|
| 502 |
+
--block-label-right-radius: 0 calc(var(--radius-sm) - 1px) 0 calc(var(--radius-sm) - 1px);
|
| 503 |
+
--block-label-text-size: var(--text-sm);
|
| 504 |
+
--block-label-text-weight: 400;
|
| 505 |
+
--block-padding: var(--spacing-xl) calc(var(--spacing-xl) + 2px);
|
| 506 |
+
--block-radius: var(--radius-sm);
|
| 507 |
+
--block-shadow: none;
|
| 508 |
+
--block-title-background-fill: none;
|
| 509 |
+
--block-title-border-color: none;
|
| 510 |
+
--block-title-border-width: 0px;
|
| 511 |
+
--block-title-padding: 0;
|
| 512 |
+
--block-title-radius: none;
|
| 513 |
+
--block-title-text-size: var(--text-md);
|
| 514 |
+
--block-title-text-weight: 400;
|
| 515 |
+
--container-radius: var(--radius-sm);
|
| 516 |
+
--form-gap-width: 0px;
|
| 517 |
+
--layout-gap: var(--spacing-xxl);
|
| 518 |
+
--panel-border-width: 0;
|
| 519 |
+
--section-header-text-size: var(--text-md);
|
| 520 |
+
--section-header-text-weight: 400;
|
| 521 |
+
--chatbot-text-size: var(--text-lg);
|
| 522 |
+
--checkbox-border-radius: var(--radius-sm);
|
| 523 |
+
--checkbox-label-gap: var(--spacing-lg);
|
| 524 |
+
--checkbox-label-padding: var(--spacing-md) calc(2 * var(--spacing-md));
|
| 525 |
+
--checkbox-label-shadow: none;
|
| 526 |
+
--checkbox-label-text-size: var(--text-md);
|
| 527 |
+
--checkbox-label-text-weight: 400;
|
| 528 |
+
--checkbox-check: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
|
| 529 |
+
--radio-circle: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
|
| 530 |
+
--checkbox-shadow: var(--input-shadow);
|
| 531 |
+
--error-border-width: 1px;
|
| 532 |
+
--input-background-fill-focus: var(--input-background-fill);
|
| 533 |
+
--input-border-width: 1px;
|
| 534 |
+
--input-padding: var(--spacing-xl);
|
| 535 |
+
--input-radius: var(--radius-sm);
|
| 536 |
+
--input-shadow: none;
|
| 537 |
+
--input-text-size: var(--text-md);
|
| 538 |
+
--input-text-weight: 400;
|
| 539 |
+
--loader-color: var(--color-accent);
|
| 540 |
+
--prose-text-size: var(--text-md);
|
| 541 |
+
--prose-text-weight: 400;
|
| 542 |
+
--prose-header-text-weight: 600;
|
| 543 |
+
--slider-color: var(--color-accent);
|
| 544 |
+
--table-radius: var(--radius-sm);
|
| 545 |
+
--button-border-width: 0px;
|
| 546 |
+
--button-transform-hover: none;
|
| 547 |
+
--button-transform-active: none;
|
| 548 |
+
--button-transition: all 0.2s ease;
|
| 549 |
+
--button-large-padding: var(--spacing-lg) calc(2 * var(--spacing-lg));
|
| 550 |
+
--button-large-radius: var(--radius-md);
|
| 551 |
+
--button-large-text-size: var(--text-lg);
|
| 552 |
+
--button-large-text-weight: 600;
|
| 553 |
+
--button-primary-shadow: none;
|
| 554 |
+
--button-secondary-shadow: var(--button-primary-shadow);
|
| 555 |
+
--button-small-padding: var(--spacing-sm) calc(1.5 * var(--spacing-sm));
|
| 556 |
+
--button-small-radius: var(--radius-md);
|
| 557 |
+
--button-small-text-size: var(--text-sm);
|
| 558 |
+
--button-small-text-weight: 400;
|
| 559 |
+
--button-medium-padding: var(--spacing-md) calc(2 * var(--spacing-md));
|
| 560 |
+
--button-medium-radius: var(--radius-md);
|
| 561 |
+
--button-medium-text-size: var(--text-md);
|
| 562 |
+
--button-medium-text-weight: 600;
|
| 563 |
+
}
|
.venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/backend/gradio_test/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (312 Bytes). View file
|
|
|
.venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/backend/gradio_test/__pycache__/test.cpython-312.pyc
ADDED
|
Binary file (1.04 kB). View file
|
|
|
.venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/demo/__pycache__/__init__.cpython-312.pyc
ADDED
|
Binary file (234 Bytes). View file
|
|
|
.venv/lib/python3.12/site-packages/gradio/_frontend_code/preview/test/test/demo/__pycache__/app.cpython-312.pyc
ADDED
|
Binary file (648 Bytes). View file
|
|
|
Gradio_UI.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gradio_UI.py
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import re
|
| 5 |
+
import mimetypes
|
| 6 |
+
import shutil
|
| 7 |
+
from typing import Optional
|
| 8 |
+
|
| 9 |
+
import gradio as gr
|
| 10 |
+
|
| 11 |
+
from smolagents.agent_types import AgentText, AgentImage, AgentAudio, handle_agent_output_types
|
| 12 |
+
from smolagents.agents import ActionStep, MultiStepAgent
|
| 13 |
+
from smolagents.memory import MemoryStep
|
| 14 |
+
from smolagents.utils import _is_package_available
|
| 15 |
+
|
| 16 |
+
def pull_messages_from_step(step_log: MemoryStep):
|
| 17 |
+
if isinstance(step_log, ActionStep):
|
| 18 |
+
step_number = f"Step {step_log.step_number}" if step_log.step_number is not None else ""
|
| 19 |
+
yield gr.ChatMessage(role="assistant", content=f"**{step_number}**")
|
| 20 |
+
|
| 21 |
+
if hasattr(step_log, "model_output") and step_log.model_output is not None:
|
| 22 |
+
model_output = re.sub(r"```.?\s*<end_code>", "```", step_log.model_output.strip())
|
| 23 |
+
yield gr.ChatMessage(role="assistant", content=model_output)
|
| 24 |
+
|
| 25 |
+
if hasattr(step_log, "tool_calls") and step_log.tool_calls:
|
| 26 |
+
tool_call = step_log.tool_calls[0]
|
| 27 |
+
content = str(tool_call.arguments.get("answer", tool_call.arguments)) if isinstance(tool_call.arguments, dict) else str(tool_call.arguments)
|
| 28 |
+
if tool_call.name == "python_interpreter":
|
| 29 |
+
content = f"```python\n{re.sub(r'<end_code>', '', content).strip()}\n```"
|
| 30 |
+
tool_msg = gr.ChatMessage(
|
| 31 |
+
role="assistant",
|
| 32 |
+
content=content,
|
| 33 |
+
metadata={"title": f"🛠️ Used tool {tool_call.name}", "id": "tool_call", "status": "pending"},
|
| 34 |
+
)
|
| 35 |
+
yield tool_msg
|
| 36 |
+
if step_log.observations:
|
| 37 |
+
yield gr.ChatMessage(role="assistant", content=step_log.observations.strip(), metadata={"title": "📝 Execution Logs", "parent_id": "tool_call", "status": "done"})
|
| 38 |
+
if step_log.error:
|
| 39 |
+
yield gr.ChatMessage(role="assistant", content=str(step_log.error), metadata={"title": "💥 Error", "parent_id": "tool_call", "status": "done"})
|
| 40 |
+
tool_msg.metadata["status"] = "done"
|
| 41 |
+
|
| 42 |
+
elif step_log.error:
|
| 43 |
+
yield gr.ChatMessage(role="assistant", content=str(step_log.error), metadata={"title": "💥 Error"})
|
| 44 |
+
|
| 45 |
+
meta = f"<span style='color:#bbb;font-size:12px;'>Input tokens: {getattr(step_log, 'input_token_count', 0)} | Output tokens: {getattr(step_log, 'output_token_count', 0)} | Duration: {round(getattr(step_log, 'duration', 0), 2)}</span>"
|
| 46 |
+
yield gr.ChatMessage(role="assistant", content=meta)
|
| 47 |
+
yield gr.ChatMessage(role="assistant", content="-----")
|
| 48 |
+
|
| 49 |
+
def stream_to_gradio(agent, task: str, reset_agent_memory: bool = False, additional_args: Optional[dict] = None):
|
| 50 |
+
total_input_tokens = 0
|
| 51 |
+
total_output_tokens = 0
|
| 52 |
+
for step_log in agent.run(task, stream=True, reset=reset_agent_memory, additional_args=additional_args):
|
| 53 |
+
if hasattr(agent.model, "last_input_token_count"):
|
| 54 |
+
total_input_tokens += agent.model.last_input_token_count
|
| 55 |
+
total_output_tokens += agent.model.last_output_token_count
|
| 56 |
+
if isinstance(step_log, ActionStep):
|
| 57 |
+
step_log.input_token_count = agent.model.last_input_token_count
|
| 58 |
+
step_log.output_token_count = agent.model.last_output_token_count
|
| 59 |
+
for message in pull_messages_from_step(step_log):
|
| 60 |
+
yield message
|
| 61 |
+
final_answer = handle_agent_output_types(step_log)
|
| 62 |
+
if isinstance(final_answer, AgentText):
|
| 63 |
+
yield gr.ChatMessage(role="assistant", content=f"**Final answer:**\n{final_answer.to_string()}")
|
| 64 |
+
elif isinstance(final_answer, AgentImage):
|
| 65 |
+
yield gr.ChatMessage(role="assistant", content={"path": final_answer.to_string(), "mime_type": "image/png"})
|
| 66 |
+
elif isinstance(final_answer, AgentAudio):
|
| 67 |
+
yield gr.ChatMessage(role="assistant", content={"path": final_answer.to_string(), "mime_type": "audio/wav"})
|
| 68 |
+
else:
|
| 69 |
+
yield gr.ChatMessage(role="assistant", content=f"**Final answer:** {str(final_answer)}")
|
| 70 |
+
|
| 71 |
+
class GradioUI:
|
| 72 |
+
def __init__(self, agent: MultiStepAgent):
|
| 73 |
+
if not _is_package_available("gradio"):
|
| 74 |
+
raise ModuleNotFoundError("Please install 'gradio' with: pip install 'smolagents[gradio]'")
|
| 75 |
+
self.agent = agent
|
| 76 |
+
|
| 77 |
+
def interact_with_agent(self, prompt, messages):
|
| 78 |
+
messages.append(gr.ChatMessage(role="user", content=prompt))
|
| 79 |
+
yield messages
|
| 80 |
+
for msg in stream_to_gradio(self.agent, task=prompt):
|
| 81 |
+
messages.append(msg)
|
| 82 |
+
yield messages
|
| 83 |
+
yield messages
|
| 84 |
+
|
| 85 |
+
def launch(self):
|
| 86 |
+
with gr.Blocks(fill_height=True) as demo:
|
| 87 |
+
stored_messages = gr.State([])
|
| 88 |
+
chatbot = gr.Chatbot(label="🌍 Mood-Based Travel Agent", type="messages")
|
| 89 |
+
user_input = gr.Textbox(lines=1, label="Describe your mood")
|
| 90 |
+
user_input.submit(
|
| 91 |
+
lambda text, hist: (hist + [gr.ChatMessage(role="user", content=text)], ""),
|
| 92 |
+
[user_input, stored_messages],
|
| 93 |
+
[stored_messages, user_input],
|
| 94 |
+
).then(self.interact_with_agent, [user_input, stored_messages], [chatbot])
|
| 95 |
+
demo.launch(debug=True, share=True)
|
| 96 |
+
|
| 97 |
+
__all__ = ["GradioUI", "stream_to_gradio"]
|
prompts.yaml
CHANGED
|
@@ -1,59 +1,111 @@
|
|
| 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 |
final_answer:
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
Ensure clarity, friendliness, and emotional alignment. Present this as a final, complete output to the user.
|
|
|
|
| 1 |
+
system_prompt: |-
|
| 2 |
+
You are a world-class travel assistant agent named WanderMind, built to help users find the perfect destination based on their mood.
|
| 3 |
+
You operate in an autonomous, multi-step thinking loop using Thought → Code → Observation.
|
| 4 |
+
|
| 5 |
+
Your job is to:
|
| 6 |
+
- Reflect on the user’s mood
|
| 7 |
+
- Infer their emotional need
|
| 8 |
+
- Suggest a travel destination with a matching activity
|
| 9 |
+
- Check the weather
|
| 10 |
+
- Decide whether the weather suits the emotional need
|
| 11 |
+
- If not, suggest another destination
|
| 12 |
+
- Once happy, find flights from the origin
|
| 13 |
+
- Wrap everything into an inspirational message
|
| 14 |
+
- Optionally, add a quote based on the mood
|
| 15 |
+
|
| 16 |
+
You must solve the full task by reasoning, calling tools or managed agents if needed, and writing Python code in the Code block.
|
| 17 |
+
|
| 18 |
+
Each step should follow this format:
|
| 19 |
+
|
| 20 |
+
Thought: explain what you will do and why.
|
| 21 |
+
Code:
|
| 22 |
+
py
|
| 23 |
+
# your code here
|
| 24 |
+
<end_code>
|
| 25 |
+
Observation: result of previous code
|
| 26 |
+
|
| 27 |
+
You must output a final result using final_answer() .
|
| 28 |
+
|
| 29 |
+
Your available tools are:
|
| 30 |
+
- mood_to_need(mood: str) → str: Extracts the emotional need behind a mood (e.g., "to reconnect").
|
| 31 |
+
- need_to_destination(need: str) → dict: Suggests a destination and activity for that need. Returns JSON with keys 'city', 'country', 'activity'.
|
| 32 |
+
- weather_forecast(location: str) → str: Gets current weather forecast.
|
| 33 |
+
- get_flights(origin: str, destination: str) → str: Lists flights between two cities.
|
| 34 |
+
- quote_from_mood(mood: str) → str: Provides a motivational quote based on mood.
|
| 35 |
+
- final_wrap(mood, need, destination, activity, weather, flights) → str: Composes final inspirational message.
|
| 36 |
+
- final_answer(output: Any): Ends the task and returns the final result.
|
| 37 |
+
|
| 38 |
+
DO NOT use a tool unless needed. Plan your steps clearly. You can retry with different inputs if the weather is bad.
|
| 39 |
+
|
| 40 |
+
Now begin!
|
| 41 |
+
|
| 42 |
+
planning:
|
| 43 |
+
initial_facts: |-
|
| 44 |
+
### 1. Facts given in the task
|
| 45 |
+
- The user provides their mood.
|
| 46 |
+
|
| 47 |
+
### 2. Facts to look up
|
| 48 |
+
- Emotional need based on mood.
|
| 49 |
+
- Destination and activity based on need.
|
| 50 |
+
- Current weather at destination.
|
| 51 |
+
- Flights from user origin to destination.
|
| 52 |
+
- Quote for mood.
|
| 53 |
+
|
| 54 |
+
### 3. Facts to derive
|
| 55 |
+
- Whether the weather fits the emotional need.
|
| 56 |
+
- If not, re-iterate destination choice.
|
| 57 |
+
- Final wrap-up message to user.
|
| 58 |
+
|
| 59 |
+
initial_plan: |-
|
| 60 |
+
1. Extract emotional need from user mood using mood_to_need().
|
| 61 |
+
2. Suggest destination and activity using need_to_destination().
|
| 62 |
+
3. Get weather at destination with weather_forecast().
|
| 63 |
+
4. Assess if weather suits the need. If not, return to step 2.
|
| 64 |
+
5. Get flights using get_flights().
|
| 65 |
+
6. Generate quote using quote_from_mood().
|
| 66 |
+
7. Compose final message using final_wrap().
|
| 67 |
+
8. Call final_answer() with all outputs.
|
| 68 |
+
<end_plan>
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
update_facts_pre_messages: |-
|
| 72 |
+
### 1. Facts given in the task
|
| 73 |
+
### 2. Facts that we have learned
|
| 74 |
+
### 3. Facts still to look up
|
| 75 |
+
### 4. Facts still to derive
|
| 76 |
+
|
| 77 |
+
update_facts_post_messages: |-
|
| 78 |
+
Please update your facts:
|
| 79 |
+
### 1. Facts given in the task
|
| 80 |
+
### 2. Facts that we have learned
|
| 81 |
+
### 3. Facts still to look up
|
| 82 |
+
### 4. Facts still to derive
|
| 83 |
+
|
| 84 |
+
update_plan_pre_messages: |-
|
| 85 |
+
Below is your current task and history. Please write a new plan based on the updated facts.
|
| 86 |
+
|
| 87 |
+
update_plan_post_messages: |-
|
| 88 |
+
Write a clean new plan with the latest facts. You must respect tool usage rules.
|
| 89 |
+
|
| 90 |
+
managed_agent:
|
| 91 |
+
task: |-
|
| 92 |
+
You are a helpful sub-agent named '{{name}}'.
|
| 93 |
+
Your manager gives you this task:
|
| 94 |
+
{{task}}
|
| 95 |
+
|
| 96 |
+
You MUST return:
|
| 97 |
+
### 1. Task outcome (short version):
|
| 98 |
+
### 2. Task outcome (extremely detailed version):
|
| 99 |
+
### 3. Additional context (if any)
|
| 100 |
+
|
| 101 |
+
Wrap everything in a final_answer().
|
| 102 |
+
|
| 103 |
+
report: |-
|
| 104 |
+
Final answer from agent '{{name}}':
|
| 105 |
+
{{final_answer}}
|
| 106 |
|
| 107 |
final_answer:
|
| 108 |
+
pre_messages: |-
|
| 109 |
+
Let's summarize everything before presenting the final answer:
|
| 110 |
+
post_messages: |-
|
| 111 |
+
Here's your final result. Enjoy your journey!
|
|
|
tools/mock_tools.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from smolagents.tools import tool
|
| 2 |
+
|
| 3 |
+
@tool
|
| 4 |
+
def mood_to_need(mood: str) -> str:
|
| 5 |
+
"""
|
| 6 |
+
Map a mood to a need.
|
| 7 |
+
|
| 8 |
+
Args:
|
| 9 |
+
mood (str): The current emotional state of the user.
|
| 10 |
+
|
| 11 |
+
Returns:
|
| 12 |
+
str: A description of what the user needs based on the mood.
|
| 13 |
+
"""
|
| 14 |
+
return "You need relaxation and nature."
|
| 15 |
+
|
| 16 |
+
@tool
|
| 17 |
+
def need_to_destination(need: str) -> str:
|
| 18 |
+
"""
|
| 19 |
+
Map a need to a destination.
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
need (str): The user's identified need (e.g., relaxation, adventure).
|
| 23 |
+
|
| 24 |
+
Returns:
|
| 25 |
+
str: A suggested destination that fulfills the need.
|
| 26 |
+
"""
|
| 27 |
+
return "Bali, Indonesia"
|
| 28 |
+
|
| 29 |
+
@tool
|
| 30 |
+
def get_weather(dest: str) -> str:
|
| 31 |
+
"""
|
| 32 |
+
Get weather forecast for a destination.
|
| 33 |
+
|
| 34 |
+
Args:
|
| 35 |
+
dest (str): The destination location.
|
| 36 |
+
|
| 37 |
+
Returns:
|
| 38 |
+
str: A weather forecast for the given destination.
|
| 39 |
+
"""
|
| 40 |
+
return "Sunny and 28°C"
|
| 41 |
+
|
| 42 |
+
@tool
|
| 43 |
+
def get_flights(dest: str) -> str:
|
| 44 |
+
"""
|
| 45 |
+
Get flight options for a destination.
|
| 46 |
+
|
| 47 |
+
Args:
|
| 48 |
+
dest (str): The destination location.
|
| 49 |
+
|
| 50 |
+
Returns:
|
| 51 |
+
str: A list of flight options for the destination.
|
| 52 |
+
"""
|
| 53 |
+
return "Flight from Paris to Bali: €600 roundtrip"
|
| 54 |
+
|
| 55 |
+
@tool
|
| 56 |
+
def final_wrap(info: str) -> str:
|
| 57 |
+
"""
|
| 58 |
+
Create a final wrap-up message.
|
| 59 |
+
|
| 60 |
+
Args:
|
| 61 |
+
info (str): Summary information about the destination and travel.
|
| 62 |
+
|
| 63 |
+
Returns:
|
| 64 |
+
str: A personalized wrap-up message.
|
| 65 |
+
"""
|
| 66 |
+
return f"Bali sounds like a perfect place for relaxation with great weather and affordable flights!"
|
| 67 |
+
|
| 68 |
+
@tool
|
| 69 |
+
def final_answer_tool(answer: str) -> str:
|
| 70 |
+
"""
|
| 71 |
+
Provides a final answer to the user.
|
| 72 |
+
|
| 73 |
+
Args:
|
| 74 |
+
answer (str): The final recommendation or conclusion.
|
| 75 |
+
|
| 76 |
+
Returns:
|
| 77 |
+
str: The same final answer.
|
| 78 |
+
"""
|
| 79 |
+
return answer
|
| 80 |
+
|
| 81 |
+
|