Spaces:
Runtime error
Runtime error
File size: 656 Bytes
f68d6be 64660ba f68d6be 26df444 f68d6be |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
from huggingface_hub import InferenceClient
client = InferenceClient("devagonal/flan-t5-rouge-durga-2")
def respond(
message,
history: list[tuple[str, str]],
):
messages.append({"role": "user", "content": message})
response = ""
for message in client.chat_completion(
messages,
):
token = message.choices[0].delta.content
response += token
yield response
"""
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
"""
demo = gr.ChatInterface(
respond,
)
if __name__ == "__main__":
demo.launch()
|