PoliticsToYou / Home.py
TomData's picture
kw update
1e8ed15
raw
history blame
1.15 kB
import gradio as gr
from src.chatbot import chatbot, keyword_search
# Adjust size of each block is not yet working
output = [gr.Dataframe(line_breaks=True)]
input = gr.Textbox()
with gr.Blocks() as App:
with gr.Tab("ChatBot"):
# Apply RAG using chatbut function from local file ChatBot.py
gr.ChatInterface(chatbot,
title="PoliticsToYou",
description= "This chatbot uses the infomation of speeches of the german parliament (since 2021) \
to get insight on the view points of the german parties and the debate of the parliament.",
examples=["Wie steht die CDU zur Cannabislegalisierung?","Was waren die wichtigsten Themen in der aktuellen Legislaturperiode?"], #change to meaningful examples
cache_examples=False, #true increases the loading time
)
with gr.Tab("KeyWordSearch"):
gr.Interface(fn=keyword_search, inputs=input, outputs=output, max_batch_size = 10)
if __name__ == "__main__":
App.launch(share=False) #true not supported on hf spaces