Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| message=[{ "role" : "system" , "content" : "You are a helpful and kind AI Assistant." }] | |
| def user_input(input): | |
| if input: | |
| input_message={"role" : "user" , "content" : input} | |
| message.append(input_message) | |
| message.append('/n') | |
| chat = message | |
| reply=message | |
| output_message={"role" : "assistant" , "content" : reply} | |
| message.append(output_message) | |
| message.append('\n') | |
| return reply | |
| input=gr.inputs.Textbox(lines=7 , label='Chat with AI') | |
| output=gr.outputs.Textbox(label='replay') | |
| interface=gr.Interface(fn=user_input, inputs="text", outputs="text", title="AI Chatbot", | |
| description="Ask anything you want", | |
| theme="compact") | |
| interface.launch() |