Spaces:
Sleeping
Sleeping
Download src/interface.py from ModularityAI/LLama3Rag: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/spaces/ModularityAI/LLama3Rag/resolve/7441e40abeb74e730d613faf74ed83fc660eda2e/src/interface.py
- Command line
-
hf download hf://spaces/ModularityAI/LLama3Rag@7441e40abeb74e730d613faf74ed83fc660eda2e/src/interface.py
-
curl -L -o interface.py https://huggingface.co/spaces/ModularityAI/LLama3Rag/resolve/7441e40abeb74e730d613faf74ed83fc660eda2e/src/interface.py
1.24 kB
| import gradio as gr | |
| # Gradio application setup | |
| def create_demo(): | |
| with gr.Blocks(title="RAG Chatbot Q&A", theme="Soft") as demo: | |
| with gr.Column(): | |
| with gr.Row(): | |
| chat_history = gr.Chatbot(value=[], elem_id='chatbot', height=680) | |
| show_img = gr.Image(label='Overview', height=680) | |
| with gr.Row(): | |
| # Add sliders here | |
| with gr.Column(): # Adjust scale as needed | |
| slider1 = gr.Slider(minimum=256, maximum=1024, value=256, label="Chunk Size") | |
| with gr.Row(): | |
| with gr.Column(scale=0.60): | |
| text_input = gr.Textbox( | |
| show_label=False, | |
| placeholder="Type here to ask your PDF", | |
| container=False) | |
| with gr.Column(scale=0.20): | |
| submit_button = gr.Button('Send') | |
| with gr.Column(scale=0.20): | |
| uploaded_pdf = gr.UploadButton("📁 Upload PDF", file_types=[".pdf"]) | |
| return demo, chat_history, show_img, text_input, submit_button, uploaded_pdf, slider1 | |
| if __name__ == '__main__': | |
| demo, chatbot, show_img, text_input, submit_button, uploaded_pdf, slider1 = create_demo() | |
| demo.queue() | |
| demo.launch() | |