Yoxas commited on
Commit
c9fc1fd
1 Parent(s): 94f8386

Update src/interface.py

Browse files
Files changed (1) hide show
  1. src/interface.py +7 -18
src/interface.py CHANGED
@@ -1,20 +1,14 @@
1
- import csv
2
  import gradio as gr
3
 
4
  # Gradio application setup
5
  def create_demo():
6
- with gr.Blocks(title="LLAMA 3 Rag Chat pdf", theme="Monochrome") as demo:
7
  # App Description
8
  gr.Markdown(
9
  """
10
- ## LLAMA 3 Rag chat pdf
11
-
12
  This application allows you to experiment with LLAMA 3 8B Instruct model for RAG.
13
- You can adjust various parameters to control the model's output.
14
-
15
- Original https://huggingface.co/spaces/ModularityAI/LLama3Rag
16
-
17
- experimented on making RAG for long pdf documents
18
  """
19
  )
20
 
@@ -29,7 +23,7 @@ def create_demo():
29
  with gr.Column(scale=0.05):
30
  with gr.Row():
31
  slider_chunk_size = gr.Slider(
32
- minimum=256, maximum=32768, value=1024, label="Chunk Size", elem_id='slider1'
33
  )
34
  with gr.Row():
35
  slider_overlap_percentage = gr.Slider(
@@ -41,7 +35,7 @@ def create_demo():
41
  )
42
  with gr.Row():
43
  slider_k = gr.Slider(
44
- minimum=1, step=1,maximum=20, value=2, label="Max Chunks in Context", elem_id='slider2'
45
  )
46
 
47
  # Input and Submit Button Row
@@ -56,15 +50,10 @@ def create_demo():
56
  submit_button = gr.Button('Send')
57
  with gr.Column(scale=0.20):
58
  uploaded_pdf = gr.UploadButton("📁 Upload PDF", file_types=[".pdf"], elem_id='upload_pdf')
59
- #NEW
60
- with gr.Column(scale=0.20):
61
- download_chat_history = gr.DownloadButton('Download chat History')
62
- #NEW
63
-
64
- return demo, chat_history, show_img, text_input, submit_button, uploaded_pdf, download_chat_history, slider_chunk_size,slider_overlap_percentage,slider_temp,slider_k
65
 
 
66
 
67
  if __name__ == '__main__':
68
- demo, chatbot, show_img, text_input, submit_button, uploaded_pdf, download_chat_history, slider_chunk_size,slider_overlap_percentage,slider_temp,slider_k = create_demo()
69
  demo.queue()
70
  demo.launch()
 
 
1
  import gradio as gr
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
  This application allows you to experiment with LLAMA 3 8B Instruct model for RAG.
11
+ You can adjust various parameters to control the model's output.
 
 
 
 
12
  """
13
  )
14
 
 
23
  with gr.Column(scale=0.05):
24
  with gr.Row():
25
  slider_chunk_size = gr.Slider(
26
+ minimum=256, maximum=1024, value=256, label="Chunk Size", elem_id='slider1'
27
  )
28
  with gr.Row():
29
  slider_overlap_percentage = gr.Slider(
 
35
  )
36
  with gr.Row():
37
  slider_k = gr.Slider(
38
+ minimum=1, step=1,maximum=5, value=2, label="Max Chunks in Context", elem_id='slider2'
39
  )
40
 
41
  # Input and Submit Button Row
 
50
  submit_button = gr.Button('Send')
51
  with gr.Column(scale=0.20):
52
  uploaded_pdf = gr.UploadButton("📁 Upload PDF", file_types=[".pdf"], elem_id='upload_pdf')
 
 
 
 
 
 
53
 
54
+ return demo, chat_history, show_img, text_input, submit_button, uploaded_pdf, slider_chunk_size,slider_overlap_percentage,slider_temp,slider_k
55
 
56
  if __name__ == '__main__':
57
+ demo, chatbot, show_img, text_input, submit_button, uploaded_pdf, slider_chunk_size,slider_overlap_percentage,slider_temp,slider_k = create_demo()
58
  demo.queue()
59
  demo.launch()