Spaces:
Sleeping
Sleeping
Prathamesh1420
commited on
Commit
•
cdac2b0
1
Parent(s):
e190137
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
-
import
|
4 |
|
5 |
def get_latest_info(query):
|
6 |
-
serpapi_key = "42e088db08191f8f2f7d516a9016f579306b5d6d3940d86d840d5370207a5b6c" # Hardcoded API key
|
7 |
-
|
8 |
-
search = client.get_dict({
|
9 |
"q": query,
|
10 |
-
"engine": "google"
|
|
|
11 |
})
|
12 |
-
results = search.get("organic_results", [])
|
13 |
if results:
|
14 |
return results[0].get("snippet", "No snippet available.")
|
15 |
else:
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
+
from serpapi import GoogleSearch # Correct import for `serpapi`
|
4 |
|
5 |
def get_latest_info(query):
|
6 |
+
serpapi_key = "42e088db08191f8f2f7d516a9016f579306b5d6d3940d86d840d5370207a5b6c" # Hardcoded API key (not recommended for production)
|
7 |
+
search = GoogleSearch({
|
|
|
8 |
"q": query,
|
9 |
+
"engine": "google",
|
10 |
+
"api_key": serpapi_key
|
11 |
})
|
12 |
+
results = search.get_dict().get("organic_results", [])
|
13 |
if results:
|
14 |
return results[0].get("snippet", "No snippet available.")
|
15 |
else:
|