File size: 576 Bytes
48dcd70
 
 
580ef04
48dcd70
 
9d6bc3c
48dcd70
 
b267fce
48dcd70
 
 
 
 
 
 
 
 
44f2abb
48dcd70
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

pipe = pipeline("text-generation", model="tiiuae/falcon-rw-1b")

def chat(text):
    result= pipe(text)
    return result

with gr.Blocks(title='Basic chatbot based on gpt2') as demo:
    with gr.Row():
        user_input = gr.Textbox(placeholder="Type your message here...", label="Your Message", lines=2)

    with gr.Row():
        output = gr.Textbox(label="Response", lines=4)

    with gr.Row():
        submit_btn = gr.Button("Send")

    submit_btn.click(fn=chat, inputs=user_input, outputs=output)

demo.launch()