jchen8000 commited on
Commit
8883910
·
verified ·
1 Parent(s): c48a156

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -10
app.py CHANGED
@@ -24,6 +24,30 @@ sample_filenames = ["Attention Is All You Need.pdf",
24
  "Parameter-Efficient Transfer Learning for NLP.pdf",
25
  ]
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  examples_questions = [["What is Transformer?"],
28
  ["What is Attention?"],
29
  ["What is Scaled Dot-Product Attention?"],
@@ -131,21 +155,13 @@ additional_inputs = [
131
  # Create the Gradio interface
132
  with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
133
  with gr.Tab("Indexing"):
 
134
  # pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
135
  # pdf_input = gr.Textbox(label="PDF File")
136
  # index_button = gr.Button("Index PDF")
137
  # load_sample = gr.Button("Alternatively, Load and Index [Attention Is All You Need.pdf] as a Sample")
138
  load_sample = gr.Button("Load and Index the following three papers as a RAG Demo")
139
- sample_description = gr.Markdown("""
140
- # 1. Attention Is All You Need (Vaswani et al., 2017)
141
- This groundbreaking paper introduced the **Transformer** architecture. It revolutionized natural language processing by enabling parallelization and significantly improving performance on tasks like translation, leading to models like *BERT* and *GPT*.
142
- # 2. Generative Adversarial Nets (Goodfellow et al., 2014)
143
- This paper proposed **GANs**, a novel framework for generative modeling using two neural networks—a generator and a discriminator—that compete in a zero-sum game. 
144
- # 3. Parameter-Efficient Transfer Learning for NLP (Houlsby et al., 2019)
145
- This paper introduces **adapter modules**, a method for fine-tuning large pre-trained language models with significantly fewer parameters.
146
-
147
- It could take several minutes to load and index the files.
148
- """)
149
  index_output = gr.Textbox(label="Indexing Status")
150
  # index_button.click(index_pdf, inputs=pdf_input, outputs=index_output)
151
  load_sample.click(load_sample_pdf, inputs=None, outputs=index_output)
 
24
  "Parameter-Efficient Transfer Learning for NLP.pdf",
25
  ]
26
 
27
+ sample_desc = """
28
+ ### 1. Attention Is All You Need (Vaswani et al., 2017)
29
+ This groundbreaking paper introduced the **Transformer** architecture. It revolutionized natural language processing by enabling parallelization and significantly improving performance on tasks like translation, leading to models like *BERT* and *GPT*.
30
+
31
+ ### 2. Generative Adversarial Nets (Goodfellow et al., 2014)
32
+ This paper proposed **GANs**, a novel framework for generative modeling using two neural networks—a generator and a discriminator—that compete in a zero-sum game. 
33
+
34
+ ### 3. Parameter-Efficient Transfer Learning for NLP (Houlsby et al., 2019)
35
+ This paper introduces **adapter modules**, a method for fine-tuning large pre-trained language models with significantly fewer parameters.
36
+
37
+ It could take several minutes to load and index the files.
38
+ """
39
+
40
+ rag_desc = """
41
+ ### This is a Demo of Retrieval-Augmented Generation (RAG)
42
+
43
+ **RAG** is an approach that combines retrieval-based and generative LLM models to improve the accuracy and relevance of generated text. 
44
+ It works by first retrieving relevant documents from an external knowledge source (like PDF files) and then using a LLM model to produce responses based on both the input query and the retrieved content. 
45
+ This method enhances factual correctness and allows the model to access up-to-date or domain-specific information without retraining.
46
+
47
+
48
+ """)
49
+
50
+
51
  examples_questions = [["What is Transformer?"],
52
  ["What is Attention?"],
53
  ["What is Scaled Dot-Product Attention?"],
 
155
  # Create the Gradio interface
156
  with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
157
  with gr.Tab("Indexing"):
158
+ gr.Markdown(rag_desc)
159
  # pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
160
  # pdf_input = gr.Textbox(label="PDF File")
161
  # index_button = gr.Button("Index PDF")
162
  # load_sample = gr.Button("Alternatively, Load and Index [Attention Is All You Need.pdf] as a Sample")
163
  load_sample = gr.Button("Load and Index the following three papers as a RAG Demo")
164
+ sample_description = gr.Markdown(sample_desc)
 
 
 
 
 
 
 
 
 
165
  index_output = gr.Textbox(label="Indexing Status")
166
  # index_button.click(index_pdf, inputs=pdf_input, outputs=index_output)
167
  load_sample.click(load_sample_pdf, inputs=None, outputs=index_output)