Spaces:
Runtime error
Runtime error
File size: 587 Bytes
1c6d86c 9c05e00 1c6d86c 9c05e00 1c6d86c 9c05e00 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import gradio as gr
from transformers import pipeline
# Load the text generation pipeline
pipe = pipeline("text-generation", model="meta-llama/Meta-Llama-3-8B-Instruct")
# Define the chatbot function
def chatbot(user_input):
# Create a message with the user input
message = {"role": "user", "content": user_input}
# Generate a response using the pipeline
response = pipe([message])[0]["generated_text"]
return response
# Create a Gradio interface for the chatbot
demo = gr.Interface(fn=chatbot, inputs="text", outputs="text")
# Launch the Gradio app
demo.launch() |