Upload 2 files
Browse files- chat.py +23 -0
- scraper.py +25 -0
chat.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from gradio_client import Client
|
2 |
+
import time
|
3 |
+
|
4 |
+
try:
|
5 |
+
print("Connecting to Space...")
|
6 |
+
# Use the public Space URL
|
7 |
+
client = Client("https://oldmonk69-dock.hf.space", timeout=120)
|
8 |
+
print("Connected successfully!")
|
9 |
+
|
10 |
+
# Test the connection
|
11 |
+
result = client.predict("Hello", api_name="/predict") # Adjust API name as needed
|
12 |
+
print(f"Test result: {result}")
|
13 |
+
|
14 |
+
except Exception as e:
|
15 |
+
print(f"Connection failed: {e}")
|
16 |
+
print("Trying alternative connection method...")
|
17 |
+
|
18 |
+
# Alternative: Try with just the space name
|
19 |
+
try:
|
20 |
+
client = Client("oldmonk69/Dock", timeout=120)
|
21 |
+
print("Connected with space name!")
|
22 |
+
except Exception as e2:
|
23 |
+
print(f"Alternative connection also failed: {e2}")
|
scraper.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from bs4 import BeautifulSoup
|
3 |
+
# Set up the URL and parameters for the request
|
4 |
+
url = "https://www.indeed.com/jobs?q=All job_listings&l=Uae"
|
5 |
+
params = {
|
6 |
+
'jk': '',
|
7 |
+
'start': 0,
|
8 |
+
'vjs': 'true'
|
9 |
+
}
|
10 |
+
# Make the request and get the response content
|
11 |
+
response = requests.get(url, params=params)
|
12 |
+
content = response.text
|
13 |
+
# Parse the HTML with BeautifulSoup
|
14 |
+
soup = BeautifulSoup(content, 'html.parser')
|
15 |
+
# Find the job listings and their details
|
16 |
+
job_listings = soup.find_all('div', class_='jobsearch-SerpJobCard')
|
17 |
+
for listing in job_listings:
|
18 |
+
title = listing.find('a', class_='jobtitle').text
|
19 |
+
company = listing.find('span', class_='company').text
|
20 |
+
location = listing.find('div', class_='recJobLoc')['data-rc-loc']
|
21 |
+
|
22 |
+
# Print the job details
|
23 |
+
print(f"Title: {title}")
|
24 |
+
print(f"Company: {company}")
|
25 |
+
print(f"Location: {location}\n")
|