Spaces:
Running
Running
Update src/App.js
Browse files- src/App.js +17 -2
src/App.js
CHANGED
|
@@ -120,10 +120,8 @@ const processReceiptText = async (text, userApiKey) => {
|
|
| 120 |
{
|
| 121 |
role: 'user',
|
| 122 |
content: `Analyze this receipt text and extract product information. Return a JSON array with objects containing: name, price, store (with name and address), and date.
|
| 123 |
-
|
| 124 |
Receipt text:
|
| 125 |
${text}
|
| 126 |
-
|
| 127 |
Please return ONLY a valid JSON array in this format:
|
| 128 |
[
|
| 129 |
{
|
|
@@ -237,6 +235,23 @@ const UploadTab = () => {
|
|
| 237 |
|
| 238 |
{step === 'upload' && (
|
| 239 |
<div className="space-y-4">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
<div className="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center">
|
| 241 |
<Upload className="mx-auto h-12 w-12 text-gray-400 mb-4" />
|
| 242 |
<label className="cursor-pointer">
|
|
|
|
| 120 |
{
|
| 121 |
role: 'user',
|
| 122 |
content: `Analyze this receipt text and extract product information. Return a JSON array with objects containing: name, price, store (with name and address), and date.
|
|
|
|
| 123 |
Receipt text:
|
| 124 |
${text}
|
|
|
|
| 125 |
Please return ONLY a valid JSON array in this format:
|
| 126 |
[
|
| 127 |
{
|
|
|
|
| 235 |
|
| 236 |
{step === 'upload' && (
|
| 237 |
<div className="space-y-4">
|
| 238 |
+
<div className="mb-4">
|
| 239 |
+
<label htmlFor="apiKey" className="block text-sm font-medium text-gray-700 mb-2">
|
| 240 |
+
Mistral API Key
|
| 241 |
+
</label>
|
| 242 |
+
<input
|
| 243 |
+
id="apiKey"
|
| 244 |
+
type="password"
|
| 245 |
+
value={apiKey}
|
| 246 |
+
onChange={(e) => setApiKey(e.target.value)}
|
| 247 |
+
placeholder="Enter your Mistral API key"
|
| 248 |
+
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
| 249 |
+
/>
|
| 250 |
+
<p className="text-xs text-gray-500 mt-1">
|
| 251 |
+
Required to process receipt images
|
| 252 |
+
</p>
|
| 253 |
+
</div>
|
| 254 |
+
|
| 255 |
<div className="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center">
|
| 256 |
<Upload className="mx-auto h-12 w-12 text-gray-400 mb-4" />
|
| 257 |
<label className="cursor-pointer">
|