jchen8000 commited on
Commit
998a648
·
verified ·
1 Parent(s): fb473f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -52
app.py CHANGED
@@ -114,62 +114,67 @@ 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
  # 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,
131
- chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
132
- examples=examples_questions,
133
- additional_inputs=additional_inputs,
134
- cache_examples=False,
135
- )
136
-
137
- # Launch the Gradio app
138
- demo.launch()
139
 
140
 
141
- # def greet(name):
142
- # return f"Hello, {name}!"
143
 
144
 
145
 
146
- # with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
147
- # # Set the title and description for the app.
148
- # gr.Markdown("# Simple Gradio Greeter")
149
- # gr.Markdown("Enter your name and get a personalized greeting!")
150
-
151
- # # Define the input component (a text box for the name).
152
- # name_input = gr.Textbox(
153
- # lines=2,
154
- # placeholder="Enter your name here...",
155
- # label="Your Name"
156
- # )
157
-
158
- # # Define the output component (a text box for the greeting).
159
- # greeting_output = gr.Textbox(label="Greeting")
160
-
161
- # # Add a button that will trigger the 'greet' function when clicked.
162
- # # The 'fn' argument specifies the function to call.
163
- # # The 'inputs' argument specifies which component's value to pass to 'fn'.
164
- # # The 'outputs' argument specifies which component will display the return value of 'fn'.
165
- # submit_button = gr.Button("Get Greeting")
166
- # submit_button.click(
167
- # fn=greet,
168
- # inputs=name_input,
169
- # outputs=greeting_output
170
- # )
171
-
172
- # # Launch the Gradio app.
173
- # # The `share=True` argument creates a public, shareable link (useful for demos).
174
- # # In a local environment, it will also open a local URL.
175
- # 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
+
118
+ def greet(name):
119
+ return f"Hello, {name}!"
120
+
121
  # Create the Gradio interface
122
+ # with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
123
+ # with gr.Tab("Indexing"):
124
+ # pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
125
+ # index_button = gr.Button("Index PDF")
126
+ # load_sample = gr.Button("Alternatively, Load and Index [Attention Is All You Need.pdf] as a Sample")
127
+ # 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.")
128
+ # index_output = gr.Textbox(label="Indexing Status")
129
+ # index_button.click(index_pdf, inputs=pdf_input, outputs=index_output)
130
+ # load_sample.click(load_sample_pdf, inputs=None, outputs=index_output)
131
 
132
+ # with gr.Tab("Chatbot"):
133
+ # gr.ChatInterface(
134
+ # fn=generate_response,
135
+ # chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
136
+ # examples=examples_questions,
137
+ # additional_inputs=additional_inputs,
138
+ # cache_examples=False,
139
+ # )
 
 
 
140
 
141
 
 
 
142
 
143
 
144
 
145
+
146
+ with gr.Blocks(theme="Nymbo/Alyx_Theme") as demo:
147
+ with gr.Tab("Indexing"):
148
+ # Set the title and description for the app.
149
+ gr.Markdown("# Simple Gradio Greeter")
150
+ gr.Markdown("Enter your name and get a personalized greeting!")
151
+
152
+ # Define the input component (a text box for the name).
153
+ name_input = gr.Textbox(
154
+ lines=2,
155
+ placeholder="Enter your name here...",
156
+ label="Your Name"
157
+ )
158
+
159
+ # Define the output component (a text box for the greeting).
160
+ greeting_output = gr.Textbox(label="Greeting")
161
+
162
+ # Add a button that will trigger the 'greet' function when clicked.
163
+ # The 'fn' argument specifies the function to call.
164
+ # The 'inputs' argument specifies which component's value to pass to 'fn'.
165
+ # The 'outputs' argument specifies which component will display the return value of 'fn'.
166
+ submit_button = gr.Button("Get Greeting")
167
+ submit_button.click(
168
+ fn=greet,
169
+ inputs=name_input,
170
+ outputs=greeting_output
171
+ )
172
+ with gr.Tab("Chatbot"):
173
+ gr.Markdown("# Simple Gradio Greeter")
174
+ gr.Markdown("Enter your name and get a personalized greeting!")
175
+
176
+
177
+ # Launch the Gradio app.
178
+ # The `share=True` argument creates a public, shareable link (useful for demos).
179
+ # In a local environment, it will also open a local URL.
180
+ demo.launch()