Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ class AIShoppingAnalyzer:
|
|
| 39 |
description=description,
|
| 40 |
model_client=self.model_client,
|
| 41 |
headless=True,
|
| 42 |
-
|
| 43 |
"args": [
|
| 44 |
"--disable-dev-shm-usage",
|
| 45 |
"--no-sandbox",
|
|
@@ -311,48 +311,53 @@ def create_gradio_interface() -> gr.Blocks:
|
|
| 311 |
</div>
|
| 312 |
""")
|
| 313 |
|
| 314 |
-
with gr.
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
inputs=[api_key, website_url, product_category, specific_product],
|
| 354 |
-
outputs=analysis_output
|
| 355 |
-
)
|
| 356 |
|
| 357 |
return demo
|
| 358 |
|
|
|
|
| 39 |
description=description,
|
| 40 |
model_client=self.model_client,
|
| 41 |
headless=True,
|
| 42 |
+
playwright_launch_kwargs={
|
| 43 |
"args": [
|
| 44 |
"--disable-dev-shm-usage",
|
| 45 |
"--no-sandbox",
|
|
|
|
| 311 |
</div>
|
| 312 |
""")
|
| 313 |
|
| 314 |
+
with gr.Row():
|
| 315 |
+
# Left column for inputs
|
| 316 |
+
with gr.Column(scale=1):
|
| 317 |
+
api_key = gr.Textbox(
|
| 318 |
+
label="OpenAI API Key",
|
| 319 |
+
placeholder="sk-...",
|
| 320 |
+
type="password",
|
| 321 |
+
container=True
|
| 322 |
+
)
|
| 323 |
+
|
| 324 |
+
website_url = gr.Textbox(
|
| 325 |
+
label="Website URL",
|
| 326 |
+
placeholder="https://your-store.com",
|
| 327 |
+
container=True
|
| 328 |
+
)
|
| 329 |
+
|
| 330 |
+
product_category = gr.Textbox(
|
| 331 |
+
label="Product Category",
|
| 332 |
+
placeholder="e.g., Electronics, Clothing, etc.",
|
| 333 |
+
container=True
|
| 334 |
+
)
|
| 335 |
+
|
| 336 |
+
specific_product = gr.Textbox(
|
| 337 |
+
label="Specific Product (Optional)",
|
| 338 |
+
placeholder="e.g., Blue Widget Model X",
|
| 339 |
+
container=True
|
| 340 |
+
)
|
| 341 |
+
|
| 342 |
+
analyze_button = gr.Button(
|
| 343 |
+
"Analyze Site",
|
| 344 |
+
size="lg",
|
| 345 |
+
variant="primary"
|
| 346 |
+
)
|
| 347 |
|
| 348 |
+
# Right column for output
|
| 349 |
+
with gr.Column(scale=1):
|
| 350 |
+
analysis_output = gr.Markdown(
|
| 351 |
+
value="Results will appear here...",
|
| 352 |
+
label="Analysis Results",
|
| 353 |
+
elem_classes="analysis-output"
|
| 354 |
+
)
|
| 355 |
+
|
| 356 |
+
analyze_button.click(
|
| 357 |
+
fn=run_analysis,
|
| 358 |
+
inputs=[api_key, website_url, product_category, specific_product],
|
| 359 |
+
outputs=analysis_output
|
| 360 |
+
)
|
|
|
|
|
|
|
|
|
|
| 361 |
|
| 362 |
return demo
|
| 363 |
|