Spaces:
Sleeping
Sleeping
| """ | |
| Loading animations for Gradio chatbot interface. | |
| Contains functions to generate animated thinking indicators with just pulsing dots. | |
| """ | |
| def create_thinking_indicator(): | |
| """ | |
| Creates an HTML thinking indicator with just animated dots. | |
| Returns: | |
| str: HTML string with animated dots only | |
| """ | |
| return '''<div class="thinking-indicator"> | |
| <div class="dots-container"> | |
| <span class="dot"></span> | |
| <span class="dot"></span> | |
| <span class="dot"></span> | |
| </div> | |
| </div>''' | |
| def create_custom_dot_indicator(dot_count=3): | |
| """ | |
| Creates a thinking indicator with specified number of dots. | |
| Args: | |
| dot_count (int): Number of animated dots (default: 3) | |
| Returns: | |
| str: HTML string with custom number of dots | |
| """ | |
| dots = ''.join(['<span class="dot"></span>' for _ in range(dot_count)]) | |
| return f'''<div class="thinking-indicator"> | |
| <div class="dots-container"> | |
| {dots} | |
| </div> | |
| </div>''' | |
| # Main function to use in the chatbot | |
| def get_thinking_dots(): | |
| """ | |
| Returns the standard thinking dots indicator. | |
| Returns: | |
| str: HTML string with animated thinking dots | |
| """ | |
| return create_thinking_indicator() | |
| # Quick usage example: | |
| if __name__ == "__main__": | |
| print("Thinking dots indicator:") | |
| print(get_thinking_dots()) |