Spaces:
Sleeping
Sleeping
Update app.py
Browse files16 unmodified lines171819202021222338 unmodified lines626364656566676859 unmodified lines12812913013113213313413513613724 unmodified lines16216316416116216316416516616516816616716816916 unmodified lines """Extracts visible text from HTML content using BeautifulSoup.""" soup = BeautifulSoup(html_content, 'html.parser') # Remove unwanted tags for tag in soup(["script", "style", "header", "footer", "nav", "form", "svg"]): for tag in soup(["script", "style", "header", "footer"]): tag.extract() return soup.get_text(strip=True)
38 unmodified lines return all_results
client = InferenceClient("microsoft/Phi-3-mini-4k-instruct")client = InferenceClient("google/gemma-1.1-7b-it")
def respond( message, history59 unmodified lines "type": "string", "description": "image generation prompt in detail.", }, "number_of_image": { "type": "integer", "description": "number of images to generate.", } }, "required": ["query"], },24 unmodified lines client_mixtral = InferenceClient("NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO") client_llama = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct") generate_kwargs = dict( max_new_tokens=2000, do_sample=True, stream=True, details=True, return_full_text=False ) question_history = "" system_message = f'You are a helpful assistant with access to the following functions: \n {str(functions_metadata)}\n\nTo use these functions respond with:\n<functioncall> {{ "name": "function_name", "arguments": {{ "arg_1": "value_1", "arg_1": "value_1", ... }} }} </functioncall> Choose functions wisely and Also reply wisely, reply with just functioncall only as tell you before, Make function while learning from Prev Questions But make sure to create function call only for Curent Question.' messages = [{"role": "system", "content": system_message}] for val in history: if val[0]: messages.append({"role": "user", "content": f"{str(val[0])}"})
messages.append({"role": "user", "content": message_text}) messages.append({"role": "user", "content": f'[SYSTEM]You are a helpful assistant with access to the following functions: \n {str(functions_metadata)}\n\nTo use these functions respond with:\n<functioncall> {{ "name": "function_name", "arguments": {{ "arg_1": "value_1", "arg_1": "value_1", ... }} }} </functioncall> Choose functions wisely and Also reply wisely, reply with just functioncall only as tell you before. [USER] {message_text} {vqa}'})
response = client.chat_completion( messages, max_tokens=150) response = str(response)app.py+7-9