Spaces:
Sleeping
Sleeping
Update app.py
Browse files16 unmodified lines1718192021222338 unmodified lines6263646566676859 unmodified lines12812913013113213324 unmodified lines15815916016116216316416516616716816917017116 unmodified lines"""Extracts visible text from HTML content using BeautifulSoup."""soup = BeautifulSoup(html_content, 'html.parser')# Remove unwanted tagsfor tag in soup(["script", "style", "header", "footer", "nav", "form", "svg"]):tag.extract()return soup.get_text(strip=True)38 unmodified linesreturn all_resultsclient = InferenceClient("microsoft/Phi-3-mini-4k-instruct")def respond(message, history59 unmodified lines"type": "string","description": "image generation prompt in detail.",},},"required": ["query"],},24 unmodified linesclient_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})response = client.chat_completion( messages, max_tokens=150)response = str(response)16 unmodified lines1718192021222338 unmodified lines6263646566676859 unmodified lines12812913013113213313413513613724 unmodified lines16216316416516616716816916 unmodified lines"""Extracts visible text from HTML content using BeautifulSoup."""soup = BeautifulSoup(html_content, 'html.parser')# Remove unwanted tagsfor tag in soup(["script", "style", "header", "footer"]):tag.extract()return soup.get_text(strip=True)38 unmodified linesreturn all_resultsclient = 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 linesclient_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 )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