saujasv's picture
make barebones gradio interface
2869f1d
raw
history blame
433 Bytes
import gradio as gr
from listener import Listener
listener = Listener("pragmatic-programs/pragmatic-ft-listener", {"do_sample": True, "num_return_sequences": 100, "num_beams": 1, "temperature": 1, "top_p": 0.9})
def synthesize(context):
spec = [[[s[:-1], s[-1]] for s in context.split(' ')]]
return listener.synthesize(spec).programs[0][0]
iface = gr.Interface(fn=synthesize, inputs="text", outputs="text")
iface.launch()