Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,22 @@ import gradio as gr
|
|
| 2 |
import requests
|
| 3 |
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
#https://lens.google.com/uploadbyurl?url=
|
| 8 |
#https://tineye.com/search/?url=
|
|
|
|
| 2 |
import requests
|
| 3 |
|
| 4 |
|
| 5 |
+
def find_it(inp):
|
| 6 |
+
try:
|
| 7 |
+
url = f"https://lens.google.com/uploadbyurl?url={inp}"
|
| 8 |
+
response = requests.get(url)
|
| 9 |
+
if response.status_code == 200:
|
| 10 |
+
page_content = response.text
|
| 11 |
+
|
| 12 |
+
soup = BeautifulSoup(page_content, "html.parser")
|
| 13 |
+
#print(soup.prettify())
|
| 14 |
+
#articles = soup.find_all("div", class_="SoaBEf")
|
| 15 |
+
#articles = soup.find_all("a")
|
| 16 |
+
#articles = soup.find_all("article", class_="MQsxIb xTewfe R7GTQ keNKEd j7vNaf Cc0Z5d VkAdve GU7x0c JMJvke q4atFc")
|
| 17 |
+
articles = soup.find_all("article")
|
| 18 |
+
print (articles)
|
| 19 |
+
except Exception as e:
|
| 20 |
+
print (e)
|
| 21 |
|
| 22 |
#https://lens.google.com/uploadbyurl?url=
|
| 23 |
#https://tineye.com/search/?url=
|