GA25s/Philosophy-Chatbot
0
import gradio as gr from transformers import pipeline
Load a pre-trained text generation model
chatbot = pipeline("text-generation", model="mistralai/Mistral-7B")
def chatbotresponse(prompt): response = chatbot(prompt, maxlength=200, dosample=True, temperature=0.7) return response[0]["generatedtext"]
interface = gr.Interface(fn=chatbotresponse, inputs="text", outputs="text") interface.launch() An example chatbot using [Gradio](https://gradio.app), [`huggingfacehub`](https://huggingface.co/docs/huggingface_hub/v0.22.2/en/index), and the Hugging Face Inference API.
