File size: 567 Bytes
12e65a2 a4a7438 12e65a2 a4a7438 12e65a2 a4a7438 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from transformers import pipeline
chat = pipeline("text-generation", model="LeoLM/leo-mistral-hessianai-7b-chat")
def chat_with_model(prompt):
response = chat(prompt, max_length=50)
return response[0]['generated_text']
# Create the Gradio interface
iface = gr.Interface(
fn=chat_with_model,
inputs=gr.inputs.Textbox(lines=2, placeholder="Type your message here..."),
outputs="text",
title="Chat with LLM",
description="Type a message and chat with a language model."
)
if __name__ == "__main__":
iface.launch() |