anycoder-7a743fbd / utils.py
kizabgd123's picture
Upload utils.py with huggingface_hub
f93cc00 verified
Raw
History Blame Contribute Delete
616 Bytes
# Utility functions for the Hey App
def format_greeting(name):
"""Format a greeting message."""
return f"Hello, {name}! Welcome to the app."
def calculate_response_time():
"""Simulate a response time calculation."""
import time
start_time = time.time()
# Simulate some processing
time.sleep(0.5)
return time.time() - start_time
def validate_input(text):
"""Validate user input."""
if not text or not text.strip():
return False, "Input cannot be empty"
if len(text) > 100:
return False, "Input too long (max 100 characters)"
return True, "Valid input"