File size: 456 Bytes
65f2296
4c9702b
e09739b
65f2296
851d5cb
e09739b
851d5cb
 
4c9702b
e09739b
65f2296
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from transformers import pipeline

# Use the text generation pipeline with DialoGPT-medium
chatbot = pipeline("text-generation", model="microsoft/DialoGPT-medium")

def chat(input_text):
    response = chatbot(input_text, max_length=50, num_return_sequences=1)
    return response[0]['generated_text']

# Gradio Interface setup
interface = gr.Interface(fn=chat, inputs="text", outputs="text")

# Launch the interface
interface.launch()