Update app.py
Browse files47 unmodified lines48495051515253545556575758596060616263626364656667686869707145 unmodified lines11711811912012012112212212312412512612712847 unmodified lines
# checking domain bounds inputs try: start = int(domain_bounds['start'][0]) start = int(domain_bounds['start'][0]) end = int(domain_bounds['end'][0]) except ValueError: raise gr.Error("Error: Start and end indices must be integers.") return None, None, None if start >= end: raise gr.Error("Start index must be smaller than end index.") raise gr.Error("Start index must be smaller than end index.") return None, None, None if start == 0 and end != 0: raise gr.Error("Indexing starts at 1. Please enter valid domain bounds.") raise gr.Error("Indexing starts at 1. Please enter valid domain bounds.") return None, None, None if start == 0 or end == 0: raise gr.Error("Domain bounds cannot be zero. Please enter valid domain bounds.") if start <= 0 or end <= 0: raise gr.Error("Domain bounds must be positive integers. Please enter valid domain bounds.") return None, None, None if start > len(sequence) or end > len(sequence): raise gr.Error("Domain bounds exceed sequence length.") return None, None, None
# checking n inputs if n == None: raise gr.Error("Choose Top N Tokens from the dropdown menu.")45 unmodified lines normalized_logits_array = F.softmax(torch.tensor(all_logits_array), dim=-1).numpy() transposed_logits_array = normalized_logits_array.T
# Plotting the heatmap # Plotting the heatmap domain_len = end - start if domain_len > 100: if 500 > domain_len > 100: step_size = 50 elif 500 <= domain_len: step_size = 100 elif domain_len < 10: step_size = 1 else:app.py+10-8