Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ from selenium import webdriver
|
|
18 |
from selenium.webdriver.chrome.options import Options
|
19 |
import chromedriver_autoinstaller
|
20 |
import os
|
21 |
-
import
|
22 |
|
23 |
# Ensure necessary NLTK resources are downloaded
|
24 |
nltk.download('punkt')
|
@@ -171,18 +171,23 @@ def search_wellness_professionals(location):
|
|
171 |
# Check if data is found
|
172 |
if google_places_data:
|
173 |
df = pd.DataFrame(google_places_data, columns=["Name", "Address", "Website"])
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
179 |
else:
|
180 |
# If no data found, return a dummy CSV with a message
|
181 |
dummy_df = pd.DataFrame([["No data found.", "", ""]], columns=["Name", "Address", "Website"])
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
|
|
|
|
|
|
186 |
|
187 |
# Gradio Interface
|
188 |
def gradio_interface(message, location, state):
|
|
|
18 |
from selenium.webdriver.chrome.options import Options
|
19 |
import chromedriver_autoinstaller
|
20 |
import os
|
21 |
+
import tempfile
|
22 |
|
23 |
# Ensure necessary NLTK resources are downloaded
|
24 |
nltk.download('punkt')
|
|
|
171 |
# Check if data is found
|
172 |
if google_places_data:
|
173 |
df = pd.DataFrame(google_places_data, columns=["Name", "Address", "Website"])
|
174 |
+
|
175 |
+
# Create a temporary file to store the CSV
|
176 |
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
|
177 |
+
df.to_csv(temp_file, index=False)
|
178 |
+
temp_file.close() # Close the file so that Gradio can download it
|
179 |
+
|
180 |
+
return temp_file.name # Return the path to the temporary file
|
181 |
else:
|
182 |
# If no data found, return a dummy CSV with a message
|
183 |
dummy_df = pd.DataFrame([["No data found.", "", ""]], columns=["Name", "Address", "Website"])
|
184 |
+
|
185 |
+
# Create a temporary file for the dummy data
|
186 |
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
|
187 |
+
dummy_df.to_csv(temp_file, index=False)
|
188 |
+
temp_file.close() # Close the file
|
189 |
+
|
190 |
+
return temp_file.name # Return the path to the dummy file
|
191 |
|
192 |
# Gradio Interface
|
193 |
def gradio_interface(message, location, state):
|