import gradio as gr from transformers import pipeline import numpy as np """ Globals! """ shortcut_js = """ """ def fix_fmt(input_text): # correct contractions (we cna't use the apostraphe) input_text = input_text.replace("I'm", "I am") input_text = input_text.replace("I'll", "I will") input_text = input_text.replace("I'd", "I would") input_text = input_text.replace("you'd", "you would") input_text = input_text.replace("he'd", "he would") input_text = input_text.replace("she'd", "she would") input_text = input_text.replace("they'd", "they would") input_text = input_text.replace("we'd", "we would") input_text = input_text.replace("You'd", "You would") input_text = input_text.replace("He'd", "He would") input_text = input_text.replace("She'd", "She would") input_text = input_text.replace("They'd", "They would") input_text = input_text.replace("We'd", "We would") input_text = input_text.replace("you'll", "you will") input_text = input_text.replace("he'll", "he will") input_text = input_text.replace("she'll", "she will") input_text = input_text.replace("they'll", "they will") input_text = input_text.replace("we'll", "we will") input_text = input_text.replace("You'll", "You will") input_text = input_text.replace("He'll", "He will") input_text = input_text.replace("She'll", "She will") input_text = input_text.replace("They'll", "They will") input_text = input_text.replace("We'll", "We will") # other contractions can be said without the apostraphe -- that is not an issue input_text = input_text.replace("'", "") input_text = input_text.replace('"', '') return input_text def get_html(input_text): inner_html = """