Update app.py
Browse files
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 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
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 |
-
|
147 |
-
|
148 |
-
|
149 |
-
#
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
#
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
#
|
164 |
-
#
|
165 |
-
#
|
166 |
-
#
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
#
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|