Update app.py
Browse files
app.py
CHANGED
|
@@ -98,4 +98,23 @@ def process_file(file, instructions, api_key):
|
|
| 98 |
draw.text((10, 10), error_message, fill=(255, 0, 0))
|
| 99 |
return [error_image] * 3
|
| 100 |
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
draw.text((10, 10), error_message, fill=(255, 0, 0))
|
| 99 |
return [error_image] * 3
|
| 100 |
|
| 101 |
+
with gr.Blocks(theme=gr.themes.Default()) as demo:
|
| 102 |
+
gr.Markdown("# Data Analysis Dashboard")
|
| 103 |
+
|
| 104 |
+
with gr.Row():
|
| 105 |
+
file = gr.File(label="Upload Dataset", file_types=[".csv", ".xlsx"])
|
| 106 |
+
instructions = gr.Textbox(label="Analysis Instructions", placeholder="Describe the analysis you want...")
|
| 107 |
+
|
| 108 |
+
api_key = gr.Textbox(label="Gemini API Key", type="password")
|
| 109 |
+
submit = gr.Button("Generate Insights", variant="primary")
|
| 110 |
+
|
| 111 |
+
output_images = [gr.Image(label=f"Visualization {i+1}") for i in range(3)]
|
| 112 |
+
|
| 113 |
+
submit.click(
|
| 114 |
+
process_file,
|
| 115 |
+
inputs=[file, instructions, api_key],
|
| 116 |
+
outputs=output_images
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
if __name__ == "__main__":
|
| 120 |
+
demo.launch()
|