Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,13 +60,13 @@ class WebScrapingSimulator:
|
|
| 60 |
results_text += f"Processed: {data['processed_at']}\n"
|
| 61 |
results_text += "-" * 50 + "\n"
|
| 62 |
|
| 63 |
-
# ✅ Create in-memory JSON file for download
|
| 64 |
-
json_bytes = json.dumps(results, indent=2).encode('utf-8')
|
| 65 |
-
file_obj = io.BytesIO(json_bytes)
|
| 66 |
-
file_obj.name = "scraping_results.json" # optional but helpful
|
| 67 |
|
| 68 |
-
return results_text, ("scraping_results.json", json_bytes), f"Processed {len(results)} URLs successfully!"
|
| 69 |
-
|
| 70 |
# Computer Vision simulator
|
| 71 |
@spaces.GPU
|
| 72 |
def simulate_cv_processing(image, model_type):
|
|
@@ -352,7 +352,7 @@ def create_portfolio_app():
|
|
| 352 |
scrape_btn.click(
|
| 353 |
scraper.simulate_scraping,
|
| 354 |
inputs=[urls_input],
|
| 355 |
-
outputs=[results_output,
|
| 356 |
)
|
| 357 |
|
| 358 |
sample_btn.click(
|
|
@@ -362,7 +362,7 @@ def create_portfolio_app():
|
|
| 362 |
|
| 363 |
clear_btn.click(
|
| 364 |
lambda: ("", "", ""),
|
| 365 |
-
outputs=[urls_input,
|
| 366 |
)
|
| 367 |
|
| 368 |
# Computer Vision Tab
|
|
|
|
| 60 |
results_text += f"Processed: {data['processed_at']}\n"
|
| 61 |
results_text += "-" * 50 + "\n"
|
| 62 |
|
| 63 |
+
# # ✅ Create in-memory JSON file for download
|
| 64 |
+
# json_bytes = json.dumps(results, indent=2).encode('utf-8')
|
| 65 |
+
# file_obj = io.BytesIO(json_bytes)
|
| 66 |
+
# file_obj.name = "scraping_results.json" # optional but helpful
|
| 67 |
|
| 68 |
+
# return results_text, ("scraping_results.json", json_bytes), f"Processed {len(results)} URLs successfully!"
|
| 69 |
+
return results_text, f"Processed {len(results)} URLs successfully!"
|
| 70 |
# Computer Vision simulator
|
| 71 |
@spaces.GPU
|
| 72 |
def simulate_cv_processing(image, model_type):
|
|
|
|
| 352 |
scrape_btn.click(
|
| 353 |
scraper.simulate_scraping,
|
| 354 |
inputs=[urls_input],
|
| 355 |
+
outputs=[results_output, status_output]
|
| 356 |
)
|
| 357 |
|
| 358 |
sample_btn.click(
|
|
|
|
| 362 |
|
| 363 |
clear_btn.click(
|
| 364 |
lambda: ("", "", ""),
|
| 365 |
+
outputs=[urls_input, status_output]
|
| 366 |
)
|
| 367 |
|
| 368 |
# Computer Vision Tab
|