parth parekh
removed gargabe roberta
3c4c0f5
raw
history blame
2.07 kB
import requests
import json
test_texts = [
"My email is [email protected]",
"Call me at (123) 456-7890",
"I live at 123 Main St, New York, NY 10001",
"Let's meet at the park tomorrow",
"My phone number is 555-1234",
"You can reach me on Skype: user123",
"Reach me at one two three dot four five six dot seven eight nine zero",
"My handle is at_symbol_user_123 on that bird app",
"Drop me a line: first_name (dot) last_name [at] big_search_engine (dot) com",
"Ring me: area code seven-seven-seven then half a dozen, a quartet, and two pairs",
"Find me on the gram: @cool_user_2023",
"I'm on that professional network, just search for John Doe from Acme Corp",
"Send a raven to Winterfell, care of the Stark family",
"Ping me on IRC: /msg CoolDude42",
"You can find me at one two three Fake Street, Anytown, State of Confusion",
"My digits are the first ten prime numbers in order",
"Contact info: tango alpha november golf oscar at yankee alpha hotel oscar oscar dot charlie oscar mike",
"Beep me at 555 (not a real area code) then 867-5309",
"I'm on that app where messages disappear, username: GhostWriter99",
"Reach out via electronic mail to 'surname underscore initial' at that fruit company dot com",
"Call me maybe? Area code is square root of 169, then 555-CHAT",
]
url = "https://vidhitmakvana1-contact-sharing-recognizer-api.hf.space/detect_contact"
for text in test_texts:
payload = {"text": text}
headers = {"Content-Type": "application/json"}
response = requests.post(url, data=json.dumps(payload), headers=headers)
if response.status_code == 200:
result = response.json()
print(f"Text: {result['text']}")
print(f"Contact Probability: {result['contact_probability']:.4f}")
print(f"Is Contact Info: {result['is_contact_info']}")
print("---")
else:
print(f"Error for text: {text}")
print(f"Status code: {response.status_code}")
print(f"Response: {response.text}")
print("---")