bibinsee/Washing_Machine_Manual_Guide_Help_Desk
0
1text_Beko_WC712 = """General safetyinstructions_2This section includes security instructions which may help prevent3the injuries and material damage risks AIl kinds of warranties shal4be invalid if these instructions are not observed,51.1Life and property safety6Never place the product on a carpet-covered floor: Electrical parts7will get overheated since air cannot circulate from under the device8This wil cause problems with your product;9Unplug the productif itisnotin use10Always have the instalation and repairing procedures carried out11by the Authorized Service Agent; Manufacturer shall not be held12Iiable for damages that may arise from procedures carried out by13unauthorized persons;14The water supply and draining hosesmustbesecurely fastened and15remain undamaged; Otherwise, waterleak may occur,16While there is stil water inside the product, never open the loading17door or remove the filter Otherwise,risk of flooding and injury from18hot water wiloccur,19Donotforce open thelocked loading door Door can be opened a few20minutes after the washing cycle ends In case of forcing the loading21door to open, the door and the lock mechanism may get damaged;22Use detergents, softeners and supplements suitable for automatic23washing machines only:24Follow the instructions on the label of textiles and the detergent25package"""26 27 28text_Beko_WV985 = """1.2 Children's safety29This product canbe used by the children who are at the age of 8 and30over and the people whose physical, sensory or mental skills are not31fully developed or who do not have necessary required experience32and knowledge as long as they are supervised or trained about the33safeuse oftheproduct anditsrisks Children shouldnotplaywith the34device: Cleaning and maintenance works should not be performed35by children unless they are supervised by someone; Children of less36than 3years should bekept away unless continuously supervised;37Packaging materials may be dangerous for the children . Keep38packaging materials in a safe place away from reach of the children39Washing Machine / Users Manual"""40 41 42text_Siemen_WG44G290BB = """Washing machine43WG44G290GB44en45User manual and installation instructions46Register your product on My Siemens and discover47exclusive services and offers.48siemens-home.bsh-group.com/welcome49The future moving in.50Siemens Home Appliances51en 52Safety53454 551 Safety56Observe the following safety instructions.57 581.1 General information59!60 Read this instruction manual carefully.61!62 Keep the instruction manual and the product information safe63for future reference or for the next owner.64!65 Do not connect the appliance if it has been damaged in transit.66 671.2 Intended use68Only use this appliance:69!70 For washing machine-washable fabrics and hand-washable wool71in accordance with the care label.72!73 With tap water and commercially available detergents and care74products suitable for washing machines.75!76 In private households and in enclosed spaces in a domestic en-77vironment.78!79 Up to an altitude of max. 4000 m above sea level.80 811.3 Restriction on user group82This appliance may be used by children aged 8 or over and by83people who have reduced physical, sensory or mental abilities or84inadequate experience and/or knowledge, provided that they are85supervised or have been instructed on how to use the appliance86safely and have understood the resulting dangers.87Do not let children play with the appliance.88Cleaning and user maintenance must not be performed by chil-89dren unless they are being supervised.90Keep children under the age of 3 years and pets away from the91appliance.92Safety93 en94595 961.4 Safe installation97Take note of the safety instructions when installing the appliance.98WARNING - Risk of electric shock!99Incorrect installation is dangerous.100 101>102 Connect and operate the appliance only in accordance with the103specifications on the rating plate.104 105>106 Connect the appliance to a power supply with alternating cur-107rent only via a properly installed socket with earthing.108 109>110 The protective conductor system of the domestic electrical in-111stallation must be properly installed. The installation must have112a sufficiently large cross section.113 114>115 When using a residual current circuit breaker, only use a type116with the 117 mark.118 119>120 Never equip the appliance with an external switching device,121e.g. a timer or remote control.122 123>124 When the appliance is installed, the mains plug of the power125cord must be freely accessible. If free access is not possible, an126all-pole isolating switch must be installed in the permanent elec-127trical installation according to the installation regulations.128 129>130 When installing the appliance, check that the power cable is not131trapped or damaged.132If the insulation of the power cord is damaged, this is dangerous.133 134>135 Never let the power cord come into contact with hot appliance136parts or heat sources.137 138>139 Never let the power cord come into contact with sharp points or140edges.141 142>143 Never kink, crush or modify the power cord.144WARNING - Risk of fire!145It is dangerous to use an extended power cord and non-approved146adapters.147 148>149 Do not use extension cables or multiple socket strips.150 151>152 Only use adapters and power cords approved by the manufac-153turer."""154 155 156text_Siemen_WG37b18KGF = """Safety1576158 159>160 If the power cord is too short and a longer one is not available,161please contact an electrician to have the domestic installation162adapted.163WARNING - Risk of injury!164The high weight of the appliance may result in injury when lifted.165 166>167 Do not lift the appliance on your own.168If this appliance is not correctly installed in a washer-dryer stack,169the installed appliance may fall.170 171>172 Only stack the dryer on a washing machine using the connec-173tion kit from the dryer manufacturer . No other installation174method is permitted.175 176>177 Do not install the appliance in a washer-dryer stack if the dryer178manufacturer does not offer a suitable connection kit.179 180>181 Do not install appliances from different manufacturers and with182varying depths and widths in a washer-dryer stack.183 184>185 Do not install a washer-dryer stack on a platform; the appli-186ances may tip over.187WARNING - Risk of suffocation!188Children may put packaging material over their heads or wrap189themselves up in it and suffocate.190 191>192 Keep packaging material away from children.193 194>195 Do not let children play with packaging material.196CAUTION - Risk of injury!197The appliance may vibrate or move when in use.198 199>200 Place the appliance on a clean, even, solid surface.201 202>203 Align the appliance using the appliance feet and a spirit level.204If hoses and power cords have been laid incorrectly, this causes a205tripping hazard.206 207>208 Lay hoses and power cords in such a way that there is no risk209of tripping.210If the appliance is moved by holding onto protruding components,211such as the appliance door, the parts may break off.212 213>214 Do not move the appliance by holding onto protruding parts.215Safety216 en2177218CAUTION - Risk of cutting!219Touching sharp edges on the appliance may lead to cuts.220 221>222 Do not touch the sharp edges on the appliance.223 224>225 Wear protective gloves when installing and transporting the ap-226pliance.227 2281.5 Safe use229WARNING - Risk of electric shock!230If the appliance or the power cord is damaged, this is dangerous.231 232>233 Never operate a damaged appliance.234 235>236 Never pull on the power cord to unplug the appliance. Always237unplug the appliance at the mains.238 239>240 If the appliance or the power cord is damaged, immediately un-241plug the power cord or switch off the fuse in the fuse box and242turn off the water tap.243 244>245 Call customer services. - 246Page 50247An ingress of moisture can cause an electric shock.248 249>250 Only use the appliance in enclosed spaces.251 252>253 Never expose the appliance to intense heat or humidity.254 255>256 Do not use steam- or high-pressure cleaners, hoses or sprays257to clean the appliance.258WARNING - Risk of harm to health!259Children can lock themselves in the appliance, there by putting260their lives at risk.261 262>263 Do not install the appliance behind a door as this may obstruct264the appliance door or prevent it from opening.265 266>267 With redundant appliances, unplug the power cord. Then cut268through the cord and damage the lock on the appliance door269beyond repair so that the appliance door will no longer close.270WARNING - Risk of suffocation!271Children may breathe in or swallow small parts, causing them to272suffocate.273 274>275 Keep small parts away from children.276 277>278 Do not let children play with small parts.279Childproof lock280 en281332823.283 Wipe the rubber gasket dry and re-284move any foreign objects.2854.286 Leave the appliance door and de-287tergent drawer open so that resid-288ual water can evaporate.289 29014 Childproof lock291Secure your appliance against being292operated unintentionally using the293controls.29414.1 Activating the childproof295lock296>297 Press and hold the two 2983 s299 but-300tons for approx. 3 seconds.301a302 The display shows 303.304a305 The controls are locked.306a307 The childproof lock remains active308even after the appliance has been309switched off and in the event of a310power failure.31114.2 Deactivating the child-312proof lock313Requirement:314 To deactivate the315childproof lock, the appliance must316be switched on.317>318 Press and hold the two 3193 s320 but-321tons for approx. 3 seconds.322a323 goes out in the display."""324 325 326 327from transformers import pipeline, MBartForConditionalGeneration, MBart50TokenizerFast328import gradio as gr329 330# Load the question-answering pipeline331question_answerer = pipeline("question-answering", model='distilbert-base-uncased-distilled-squad')332 333# Load the summarization pipeline334summarizer = pipeline("summarization", model="facebook/bart-large-cnn")335 336# Load the translation model and tokenizer337translation_model = MBartForConditionalGeneration.from_pretrained("facebook/mbart-large-50-one-to-many-mmt")338translation_tokenizer = MBart50TokenizerFast.from_pretrained("facebook/mbart-large-50-one-to-many-mmt", src_lang="en_XX")339 340# Define the function for question-answering341def answer_question(company, model, question):342 if company == "Beko":343 if model == "WC712":344 context = text_Beko_WC712345 elif model == "WV985":346 context = text_Beko_WV985347 else:348 raise ValueError("Invalid model number selected.")349 elif company == "Siemen":350 if model == "WG44G290BB":351 context = text_Siemen_WG44G290BB352 elif model == "WG37b18KGF":353 context = text_Siemen_WG37b18KGF354 else:355 raise ValueError("Invalid model number selected.")356 else:357 raise ValueError("Invalid company selected.")358 359 qa_result = question_answerer(question=question, context=context)360 return qa_result['answer']361 362# Define the function for summarization363def summarize(input_text):364 summarization_result = summarizer(input_text)365 return summarization_result[0]['summary_text']366 367def pdf_summarize(company, model, topic):368 # Check if the selected company and model are valid369 if company not in ["Beko", "Siemen"]:370 raise ValueError("Invalid company selected.")371 if model not in ["WC712", "WV985", "WG44G290BB", "WG37b18KGF"]:372 raise ValueError("Invalid model number selected.")373 374 # Define the summarized text for different topics375 summarization_texts = {376 "Summarization of General Safety Instructions": "Never place the product on a carpet-covered floor. Unplug the product if it is not in use. The water supply and draining hoses must be securely fastened and remain undamaged. While there is still water inside the product, never open the loading door or remove the filter. Do not force open the locked loading door.",377 "Summarization of Children's Safety": "Children may breathe in or swallow small parts, causing them to suffocate. Children should not play with the device. Packaging materials may be dangerous for children. Keep packaging materials in a safe place away from the reach of children.",378 "Summarization of Restriction on User Group": "This product can be used by children who are at the age of 8 and over and people whose physical, sensory, or mental skills are not fully developed or who do not have the necessary required experience and knowledge as long as they are supervised or trained about the safe use of the product and its risks. Children of less than 3 years should be kept away unless continuously supervised.",379 "Summarization of Energy Efficiency Tips": "To maximize energy efficiency, always use the washing machine with a full load of laundry. Avoid overloading the machine, as it can lead to decreased performance and higher energy consumption. Use cold water for washing whenever possible, as it saves energy and reduces the cost of heating water. Additionally, consider using the appropriate wash cycle for the type of laundry to minimize unnecessary energy usage. Regularly clean the lint filter and perform maintenance tasks to ensure the machine operates at its best efficiency."380 }381 382 # Check if the selected topic is valid383 if topic not in summarization_texts:384 raise ValueError("Invalid topic selected.")385 386 # Return the summarized text for the selected topic387 return summarization_texts[topic]388 389# Define the function for translation390def translate(input_text, target_lang):391 # Map the target language selected by the user to the corresponding language code392 lang_mapping = {393 "Malayalam": "ml",394 "Tamil": "ta",395 "Hindi": "hi",396 "Gujarati": "gu",397 "Bengali": "bn",398 "Marathi": "mr",399 "Telugu": "te"400 }401 lang_code = f"{lang_mapping[target_lang]}_IN"402 403 # Tokenize the input text404 model_inputs = translation_tokenizer(input_text, return_tensors="pt")405 406 # Generate the translation407 generated_tokens = translation_model.generate(408 **model_inputs,409 forced_bos_token_id=translation_tokenizer.lang_code_to_id[lang_code],410 max_new_tokens=50 # Adjust the value of max_new_tokens as per your preference411 )412 413 # Decode the generated tokens and return the translation414 return translation_tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]415 416 417 418# Create the Gradio interfaces for question-answering, summarization, and translation419qa_interface = gr.Interface(420 fn=answer_question,421 inputs=[422 gr.Dropdown(423 ["Beko", "Siemen"], 424 label="Select Company", 425 default="Beko" 426 ),427 gr.Dropdown(428 ["WC712", "WV985", "WG44G290BB", "WG37b18KGF"],429 label="Select Model Number",430 default="WC712"431 ),432 gr.Textbox(label="Question", placeholder="Enter your question here...")433 ],434 outputs=gr.Textbox(label="Answer"),435 title="Washing Machine Manual Guide Help Desk - Question-Answering",436 description="Ask any question related to the washing machine manual guide and get answers! Powered by `distilbert-base-uncased-distilled-squad` model.",437 examples=[438 ["Beko", "WC712", "Does the manufacturer hold liable for damages that may arise from procedures carried out by unauthorized persons?"],439 ["Beko", "WV985", "At what age can children use the product?"],440 ["Siemen", "WG44G290BB", "What is the maximum altitude intended for use?"],441 ["Siemen", "WG37b18KGF", "What should we do if the power cord is too short and a longer one is not available?"]442 ],443 flagging_options=["Inappropriate Answer"]444)445 446summarization_interface = gr.Interface(447 fn=summarize,448 inputs=[gr.Textbox(label="Don't have time? Looking for an abstract? Paste any text to summarize and get it done quickly!", lines=6, placeholder="Paste any text to summarize here...")],449 outputs=gr.Textbox(label="Summary", lines=3),450 title="Washing Machine Manual Guide Help Desk - Text Summarization",451 description="Summarize any text using the `facebook/bart-large-cnn` model under the hood!",452 examples=[453 ["This product can be used by the children who are at the age of 8 and over and the people whose physical, sensory or mental skills are not fully developed or who do not have necessary required experience and knowledge as long as they are supervised or trained about the safe use oftheproduct anditsrisks Children shouldnotplaywith the device: Cleaning and maintenance works should not be performed by children unless they are supervised by someone. Children of less than 3 years should bekept away unless continuously supervised. Packaging materials may be dangerous for the children . Keep packaging materials in a safe place away from reach of the children"]454 ],455 flagging_options=["Inappropriate Answer"]456)457 458# Define the target languages for translation459target_languages = ["Tamil", "Malayalam", "Telugu", "Marathi", "Gujarati", "Hindi", "Bengali"]460 461translation_interface = gr.Interface(462 fn=translate,463 inputs=[464 gr.Textbox(label="Enter text to translate here...", lines=6, placeholder="Paste any text to translate here..."),465 gr.Dropdown(target_languages, label="Select Target Language")466 ],467 outputs=gr.Textbox(label="Translation"),468 title="Washing Machine Manual Guide Help Desk - Translation",469 description="Translate the text from English to the selected local language. Powered by `facebook/mbart-large-50-one-to-many-mmt` model",470 examples=[471 ["Do not install the appliance behind a door as this may obstruct the appliance door or prevent it from opening", "Tamil"],472 ["Leave the appliance door and detergent drawer open so that residual water can evaporate", "Malayalam"],473 ["Children may breathe in or swallow small parts, causing them to suffocate", "Telugu"],474 ["Never expose the appliance to intense heat or humidity", "Marathi"],475 ["If the appliance or the power cord is damaged, immediately unplug the power cord or switch off the fuse in the fuse box and turn off the water tap", "Gujarati"],476 ["Do not touch the sharp edges on the appliance", "Hindi"],477 ["Keep the instruction manual and the product information safe for future reference or for the next owner", "Bengali"]478 ],479 flagging_options=["Inappropriate Answer"]480)481 482summarization_topic_interface = gr.Interface(483 fn=pdf_summarize,484 inputs=[485 gr.Dropdown(486 ["Beko", "Siemen"], 487 label="Select Company", 488 default="Beko" 489 ),490 gr.Dropdown(491 ["WC712", "WV985", "WG44G290BB", "WG37b18KGF"],492 label="Select Model Number",493 default="WC712"494 ),495 gr.Dropdown(496 ["Summarization of General Safety Instructions", "Summarization of Children's Safety", "Summarization of Restriction on User Group"],497 label="Select Topic for Summarization"498 )499 ],500 outputs=gr.Textbox(label="Summary", lines=3),501 title="Washing Machine Manual Guide Help Desk - Summarization by Topic",502 description="Summarize specific topics related to the washing machine manual guide!",503 examples=[504 ["Beko", "WC712", "Summarization of General Safety Instructions"],505 ["Siemen", "WG37b18KGF", "Summarization of Children's Safety"],506 ["Beko", "WV985", "Summarization of Restriction on User Group"],507 ["Siemen", "WG44G290BB", "Summarization of Energy Efficiency Tips"]508 509 ],510 flagging_options=["Inappropriate Answer"]511)512 513# Combine the interfaces into a tabbed interface514tabbed_interface = gr.TabbedInterface([qa_interface, summarization_interface, translation_interface, summarization_topic_interface], 515 ["Question-Answering", "Text Summarization", "Translation", "Summarization by Topic"])516 517# Launch the tabbed interface518tabbed_interface.launch()519 