Spaces:
Runtime error
Runtime error
from happytransformer import HappyTextToText, TTSettings | |
top_p_sampling_settings = TTSettings(num_beams=25, min_length=0, max_length=512, early_stopping=True) | |
from happytransformer import HappyTextToText, TTSettings | |
import gradio as gr | |
happy_tt = HappyTextToText("T5", "swcrazyfan/Kingify-2Way-T5-Large-v1_1") | |
ttsettings = TTSettings(num_beams=25, min_length=0, max_length=512, early_stopping=True) | |
def kingify(text, choice): | |
if choice == "Kingify": | |
text = "kingify: " + text | |
else: | |
text = "dekingify: " + text | |
result = happy_tt.generate_text(text, args=ttsettings) | |
return result.text | |
iface = gr.Interface(kingify, [gr.inputs.Textbox(lines=5, label="Text to Kingify"), gr.inputs.Radio(["Kingify", "Dekingify"], label="Kingify or Dekingify?")], gr.outputs.Textbox(label="Kingified Text")) | |
iface.launch(inline=False) |