jchen8000 commited on
Commit
8599fab
·
verified ·
1 Parent(s): e38a44f

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -15
app.py CHANGED
@@ -114,23 +114,17 @@ additional_inputs = [
114
  gr.Number(precision=0, value=0, label="Seed", info="A starting point to initiate generation, use 0 for random")
115
  ]
116
 
117
-
118
- def greet(name):
119
- return f"Hello, {name}!"
120
-
121
  # Create the Gradio interface
122
- with gr.Blocks(theme=gr.themes.Default()) as demo:
123
- with gr.Tab("Indexig"):
124
- # pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
125
- # pdf_input = gr.Textbox(label="PDF input")
126
- pdf_input = gr.File(file_count="single", file_types=[".pdf"], label="Upload PDF documents")
127
  index_button = gr.Button("Index PDF")
128
  load_sample = gr.Button("Alternatively, Load and Index [Attention Is All You Need.pdf] as a Sample")
129
  sample_description = gr.Markdown("This sample PDF is a seminal paper in the field of machine learning, titled 'Attention Is All You Need' at https://arxiv.org/abs/1706.03762. It introduces the Transformer model, which has become foundational in natural language processing.")
130
  index_output = gr.Textbox(label="Indexing Status")
131
  index_button.click(index_pdf, inputs=pdf_input, outputs=index_output)
132
  load_sample.click(load_sample_pdf, inputs=None, outputs=index_output)
133
-
134
  with gr.Tab("Chatbot"):
135
  gr.ChatInterface(
136
  fn=generate_response,
@@ -138,9 +132,7 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
138
  examples=examples_questions,
139
  additional_inputs=additional_inputs,
140
  cache_examples=False,
141
- )
142
-
143
- # Launch the Gradio app.
144
- # The `share=True` argument creates a public, shareable link (useful for demos).
145
- # In a local environment, it will also open a local URL.
146
  demo.launch()
 
114
  gr.Number(precision=0, value=0, label="Seed", info="A starting point to initiate generation, use 0 for random")
115
  ]
116
 
 
 
 
 
117
  # Create the Gradio interface
118
+ with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
119
+ with gr.Tab("Indexing"):
120
+ pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
 
 
121
  index_button = gr.Button("Index PDF")
122
  load_sample = gr.Button("Alternatively, Load and Index [Attention Is All You Need.pdf] as a Sample")
123
  sample_description = gr.Markdown("This sample PDF is a seminal paper in the field of machine learning, titled 'Attention Is All You Need' at https://arxiv.org/abs/1706.03762. It introduces the Transformer model, which has become foundational in natural language processing.")
124
  index_output = gr.Textbox(label="Indexing Status")
125
  index_button.click(index_pdf, inputs=pdf_input, outputs=index_output)
126
  load_sample.click(load_sample_pdf, inputs=None, outputs=index_output)
127
+
128
  with gr.Tab("Chatbot"):
129
  gr.ChatInterface(
130
  fn=generate_response,
 
132
  examples=examples_questions,
133
  additional_inputs=additional_inputs,
134
  cache_examples=False,
135
+ )
136
+
137
+ # Launch the Gradio app
 
 
138
  demo.launch()