File size: 578 Bytes
c634a8f
 
 
32c15f7
d9e5cc1
b81a54b
d9e5cc1
fd51a5f
d9e5cc1
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Week - 3 Assignment - Integrate Traditional Chatbot with AI Service Project (Transformers) Praveen Kumar Parimi

#importing the required libraries including transformers
import gradio as gr
from transformers import pipeline

def chat_response(prompt):

    model_name = "bmas10/ForJerry"
    pipe = pipeline("text-generation", model=model_name)
    messages = [{"role": "user", "content": prompt}]
    return pipe(messages)

iface = gr.Interface(
    fn=chat_response,
    inputs=gr.Textbox(placeholder="Type your message here..."),
    outputs=gr.Textbox()
)

iface.launch()