Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,21 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
messages.extend(history)
|
| 13 |
-
|
| 14 |
-
messages.append({"role": "user", "content": message})
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
response = client.chat_completion(
|
| 18 |
-
messages,
|
| 19 |
-
max_tokens=100
|
| 20 |
-
)
|
| 21 |
-
return response['choices'][0]['message']['content'].strip()
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
chatbot = gr.ChatInterface(respond, type="messages" , title="Friendly chatbot")
|
| 26 |
-
|
| 27 |
-
chatbot.launch()
|
|
|
|
| 1 |
+
from apify_client import ApifyClient
|
| 2 |
|
| 3 |
+
# Initialize the ApifyClient with your Apify API token
|
| 4 |
+
# Replace '<YOUR_API_TOKEN>' with your token.
|
| 5 |
+
client = ApifyClient("<YOUR_API_TOKEN>")
|
| 6 |
|
| 7 |
+
# Prepare the Actor input
|
| 8 |
+
run_input = { "inputURL": [
|
| 9 |
+
{ "url": "https://www.lidl.co.uk/c/food-drink/s10068374?offset=24" },
|
| 10 |
+
{ "url": "https://www.lidl.co.uk/p/ripen-at-home-loose-mango/p10030752#searchTrackingMasterId=Product.10030752&searchTrackingTitle=Ripen-at-Home+Loose+Mango&searchTrackingPageSize=12&searchTrackingPage=2&searchTrackingEvent=click&searchTrackingId=Product.10030752&searchTrackingOrigPos=1&searchTrackingPos=20&searchTrackingOrigPageSize=12&searchTrackingChannel=GB&list=search" },
|
| 11 |
+
] }
|
| 12 |
|
| 13 |
+
# Run the Actor and wait for it to finish
|
| 14 |
+
run = client.actor("thenetaji/lidl-scraper").call(run_input=run_input)
|
| 15 |
|
| 16 |
+
# Fetch and print Actor results from the run's dataset (if there are any)
|
| 17 |
+
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
|
| 18 |
+
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
|
| 19 |
+
print(item)
|
| 20 |
|
| 21 |
+
# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|