Spaces:
Sleeping
Sleeping
File size: 659 Bytes
ef08c9e 9b9df02 ef08c9e 9b9df02 ef08c9e 9b9df02 ef08c9e 9b9df02 ef08c9e edf6046 9b9df02 ef08c9e 9b9df02 edf6046 5d39370 ef08c9e 9b9df02 |
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 |
import gradio as gr
from chatbot_rag import get_answer # import your function
def respond(message, history):
"""
Respond function for Gradio ChatInterface.
message: latest user query
history: full chat history (list of [user, bot] pairs)
"""
# Call your RAG pipeline
response = get_answer(message)
return response
# Simple Gradio Chat Interface
chatbot = gr.ChatInterface(
fn=respond,
type="messages", # since your RAG returns plain text
title="Harry Potter Wikipedia",
description="It might take little long time to response, wait for the MAGIC."
)
if __name__ == "__main__":
chatbot.launch()
|