new code
Browse files- src/interface.py +32 -32
src/interface.py
CHANGED
|
@@ -2,52 +2,52 @@ import gradio as gr
|
|
| 2 |
|
| 3 |
# Gradio application setup
|
| 4 |
def create_demo():
|
| 5 |
-
|
| 6 |
with gr.Blocks(title="LLAMA 3 Rag on Fly", theme="Monochrome") as demo:
|
| 7 |
# App Description
|
| 8 |
gr.Markdown(
|
| 9 |
"""
|
| 10 |
## LLAMA 3 Rag on Fly App
|
| 11 |
|
| 12 |
-
This application allows you to experiment with a LLAMA 3 model for RAG powered Chatbot.
|
| 13 |
-
You can adjust various parameters to control the model's output.
|
| 14 |
"""
|
| 15 |
)
|
| 16 |
-
with gr.Column(scale=-0.75):
|
| 17 |
-
with gr.Row():
|
| 18 |
-
chat_history = gr.Chatbot(value=[], elem_id='chatbot', height=480)
|
| 19 |
-
show_img = gr.Image(label='Overview', height=480)
|
| 20 |
-
|
| 21 |
-
# Sliders in the Rightmost Column
|
| 22 |
-
with gr.Column(scale=0.25):
|
| 23 |
-
with gr.Row():
|
| 24 |
-
slider_chunk_size = gr.Slider(
|
| 25 |
-
minimum=256, maximum=1024, value=256, label="Chunk Size", elem_id='slider1'
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
with gr.Row():
|
| 29 |
-
slider_overlap_percentage = gr.Slider(
|
| 30 |
-
minimum=0, maximum=100, value=50, label="Chunk Overlap Percentage", elem_id='slider2'
|
| 31 |
-
)
|
| 32 |
-
|
| 33 |
-
with gr.Row():
|
| 34 |
-
slider_temp = gr.Slider(
|
| 35 |
-
minimum=0, maximum=1, value=0.5, label="Model Temperature", elem_id='slider3'
|
| 36 |
-
)
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
with gr.Row():
|
| 40 |
-
slider_k = gr.Slider(
|
| 41 |
-
minimum=1, maximum=5, value=2, label="Max Chunks in Context", elem_id='slider2'
|
| 42 |
-
)
|
| 43 |
-
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
with gr.Row():
|
| 46 |
with gr.Column(scale=0.60):
|
| 47 |
text_input = gr.Textbox(
|
| 48 |
show_label=False,
|
| 49 |
placeholder="Type here to ask your PDF",
|
| 50 |
-
|
|
|
|
| 51 |
with gr.Column(scale=0.20):
|
| 52 |
submit_button = gr.Button('Send')
|
| 53 |
with gr.Column(scale=0.20):
|
|
|
|
| 2 |
|
| 3 |
# Gradio application setup
|
| 4 |
def create_demo():
|
|
|
|
| 5 |
with gr.Blocks(title="LLAMA 3 Rag on Fly", theme="Monochrome") as demo:
|
| 6 |
# App Description
|
| 7 |
gr.Markdown(
|
| 8 |
"""
|
| 9 |
## LLAMA 3 Rag on Fly App
|
| 10 |
|
| 11 |
+
This application allows you to experiment with a LLAMA 3 model for RAG powered Chatbot.
|
| 12 |
+
You can adjust various parameters to control the model's output.
|
| 13 |
"""
|
| 14 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
with gr.Row():
|
| 17 |
+
# Chatbot and Image Column (75% space)
|
| 18 |
+
with gr.Column(scale=0.75):
|
| 19 |
+
with gr.Row():
|
| 20 |
+
chat_history = gr.Chatbot(value=[], elem_id='chatbot', height=480)
|
| 21 |
+
with gr.Row():
|
| 22 |
+
show_img = gr.Image(label='Overview', height=480)
|
| 23 |
+
|
| 24 |
+
# Sliders Column (25% space)
|
| 25 |
+
with gr.Column(scale=0.25):
|
| 26 |
+
with gr.Row():
|
| 27 |
+
slider_chunk_size = gr.Slider(
|
| 28 |
+
minimum=256, maximum=1024, value=256, label="Chunk Size", elem_id='slider1'
|
| 29 |
+
)
|
| 30 |
+
with gr.Row():
|
| 31 |
+
slider_overlap_percentage = gr.Slider(
|
| 32 |
+
minimum=0, maximum=100, value=50, label="Chunk Overlap Percentage", elem_id='slider2'
|
| 33 |
+
)
|
| 34 |
+
with gr.Row():
|
| 35 |
+
slider_temp = gr.Slider(
|
| 36 |
+
minimum=0, maximum=1, value=0.5, label="Model Temperature", elem_id='slider3'
|
| 37 |
+
)
|
| 38 |
+
with gr.Row():
|
| 39 |
+
slider_k = gr.Slider(
|
| 40 |
+
minimum=1, maximum=5, value=2, label="Max Chunks in Context", elem_id='slider2'
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
# Input and Submit Button Row
|
| 44 |
with gr.Row():
|
| 45 |
with gr.Column(scale=0.60):
|
| 46 |
text_input = gr.Textbox(
|
| 47 |
show_label=False,
|
| 48 |
placeholder="Type here to ask your PDF",
|
| 49 |
+
container=False
|
| 50 |
+
)
|
| 51 |
with gr.Column(scale=0.20):
|
| 52 |
submit_button = gr.Button('Send')
|
| 53 |
with gr.Column(scale=0.20):
|