Spaces:
Sleeping
Sleeping
Vaishnav14220 commited on
Commit ·
124394f
1
Parent(s): e836a09
Add new tab to view all reactions in tabular format
Browse files
app.py
CHANGED
|
@@ -250,6 +250,14 @@ with gr.Blocks(title="Organic Reactions Search") as demo:
|
|
| 250 |
pdf_btn = gr.Button("Generate and Download PDF")
|
| 251 |
pdf_output = gr.File(label="Download PDF")
|
| 252 |
pdf_btn.click(generate_all_reactions_pdf, outputs=pdf_output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
gr.Markdown("""
|
| 254 |
## API Endpoints
|
| 255 |
|
|
|
|
| 250 |
pdf_btn = gr.Button("Generate and Download PDF")
|
| 251 |
pdf_output = gr.File(label="Download PDF")
|
| 252 |
pdf_btn.click(generate_all_reactions_pdf, outputs=pdf_output)
|
| 253 |
+
|
| 254 |
+
with gr.Tab("View All Reactions (Table)"):
|
| 255 |
+
gr.Markdown("Browse all 828 reactions in a tabular format.")
|
| 256 |
+
# Prepare data for table display
|
| 257 |
+
table_data = df[['corrected_name', 'general_reactants', 'general_reagents', 'general_products']].copy()
|
| 258 |
+
table_data['description'] = df['description'].str[:100] + '...' # Truncate description
|
| 259 |
+
table_data.columns = ['Reaction Name', 'Reactants', 'Reagents', 'Products', 'Description (truncated)']
|
| 260 |
+
table_output = gr.Dataframe(value=table_data, label="All Reactions", interactive=False)
|
| 261 |
gr.Markdown("""
|
| 262 |
## API Endpoints
|
| 263 |
|