Spaces:
Runtime error
Runtime error
File size: 540 Bytes
749641b 80f6826 749641b a2d5911 80f6826 12c408e a2d5911 12c408e 749641b 12c408e 926685a 24a6738 926685a 12c408e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import gradio as gr
from transformers import pipeline
pipeline = pipeline(task="text-generation", model="starcoder2-15b")
def chatbot(input_text):
generated_text = pipeline(input_text, max_length=50)
return input_text, "Chatbot: " + generated_text[0]["generated_text"]
chatbot_app = gr.Interface(
chatbot,
inputs=gr.Textbox(lines=2, label="You:"),
outputs=gr.Textbox(label="Chatbot:", placeholder="Chatbot's response will appear here..."),
title="Chatbot UI"
)
if __name__ == "__main__":
chatbot_app.launch() |