| import gradio as gr | |
| from content import conn | |
| from content import ad | |
| import time | |
| def stream_function(input, history): | |
| res = conn.sub(input) | |
| s='' | |
| for r in res: | |
| s+=r | |
| yield s | |
| s+='\n\n'+ad.T | |
| yield s | |
| # def start(): | |
| # input_con = gr.Textbox(label="input", lines=1) | |
| # output_con = gr.Textbox(label="output", lines=20) | |
| # iface = gr.Interface( | |
| # fn=stream_function, | |
| # inputs= input_con, | |
| # outputs= output_con, | |
| # ) | |
| # #iface.launch(share=True) | |
| # return iface | |
| if __name__ == '__main__': | |
| demo = gr.ChatInterface(stream_function).queue() | |
| demo.launch(share=True) | |