rachea commited on
Commit
da9096d
·
verified ·
1 Parent(s): 9378acb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -22
app.py CHANGED
@@ -1,27 +1,21 @@
1
- import gradio as gr
2
 
3
- from huggingface_hub import InferenceClient
 
 
4
 
5
- client = InferenceClient("microsoft/phi-4")
 
 
 
 
6
 
7
- def respond(message, history):
 
8
 
9
- messages = [{"role": "system", "content": "you are a friendly chatbot"}]
 
 
 
10
 
11
- if history:
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