import torch from transformers import AutoModelForCausalLM, AutoTokenizer def extract_responses(text): """ Extracts and returns the responses from the text, excluding the parts between and including the [INST] tags. Args: text (str): The input text containing responses and [INST] tags. Returns: str: The extracted responses. """ import re # Split the text by [INST] tags and accumulate non-tag parts parts = re.split(r'\[INST\].*?\[/INST\]', text, flags=re.DOTALL) cleaned_text = "".join(parts) # Return the cleaned and trimmed text return cleaned_text.strip() def generate_html(): return( '''
This interactive app leverages the power of a fine-tuned Phi 2 AI model to provide insightful responses. Type your query below and witness AI in action.