FirstChatBot / app.py
TeahReichenbaum's picture
Update app.py
f92e17c verified
raw
history blame
590 Bytes
import gradio as gr
import random
import os
from huggingface_hub import InferenceClient
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
def respond(message,history):
messages = [{"role": "system", "content": "You are a friendly chatbot."}]
if history:
messages.extend(history)
messages.append({"role":"user","content":messages})
response = client.chat_completion(
mesages,
max_token=100)
return response ['choices'][0]['message']['content'].strip()
chatbot = gr.ChatInterface(repsond, type = "messages")
chatbot.launch()