Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,26 @@
|
|
| 1 |
-
import phonenumbers
|
| 2 |
-
from OpenCageGeocoder import opencage.geocoder
|
| 3 |
-
import folium
|
| 4 |
import streamlit as st
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
def
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def main():
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
st.
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
st.map(map)
|
| 23 |
|
| 24 |
if __name__ == "__main__":
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import phonenumbers
|
| 3 |
+
from phonenumbers import geocoder
|
| 4 |
|
| 5 |
+
def track_phone_number_location(phone_number_str):
|
| 6 |
+
try:
|
| 7 |
+
phone_number = phonenumbers.parse(phone_number_str, None)
|
| 8 |
+
if phonenumbers.is_valid_number(phone_number):
|
| 9 |
+
location_info = geocoder.description_for_number(phone_number, "en")
|
| 10 |
+
return location_info
|
| 11 |
+
else:
|
| 12 |
+
return "Invalid phone number."
|
| 13 |
+
except phonenumbers.NumberParseException:
|
| 14 |
+
return "Invalid phone number format."
|
| 15 |
|
| 16 |
def main():
|
| 17 |
+
st.title("Phone Number Location Tracker")
|
| 18 |
+
st.write("Enter a phone number below to track its approximate location:")
|
| 19 |
+
|
| 20 |
+
phone_number_str = st.text_input("Phone Number:")
|
| 21 |
+
if st.button("Track Location"):
|
| 22 |
+
location = track_phone_number_location(phone_number_str)
|
| 23 |
+
st.write(f"Location: {location}")
|
|
|
|
| 24 |
|
| 25 |
if __name__ == "__main__":
|
| 26 |
+
main()
|