File size: 1,122 Bytes
4fc79a4
ff768e2
 
4fc79a4
 
29f87f1
4fc79a4
 
4b1e329
4fc79a4
4b1e329
 
eb443e3
29f87f1
 
eb443e3
 
29f87f1
4b1e329
 
eb443e3
4fc79a4
 
eb443e3
e6ca829
4fc79a4
29f87f1
4fc79a4
29f87f1
4fc79a4
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import gradio as gr
import pandas as pd
import matplotlib.pyplot as plt
import io
import google.generativeai as genai
from PIL import Image

def process_file(api_key, file, instructions):
    # ... [keep the existing process_file function identical] ...

# Fixed Gradio interface with compatible theme settings
with gr.Blocks(theme=gr.themes.Default(spacing_size="lg")) as demo:  # Changed from "xl" to "lg"
    gr.Markdown("# **HD Data Visualizer**  πŸ“Šβœ¨")
    
    with gr.Row():
        api_key = gr.Textbox(label="πŸ”‘ Gemini API Key", type="password")
        file = gr.File(label="πŸ“ Upload Dataset", file_types=[".csv", ".xlsx"])
    
    instructions = gr.Textbox(label="πŸ’‘ Custom Instructions (optional)", 
                            placeholder="E.g.: Focus on time series patterns...")
    submit = gr.Button("πŸš€ Generate Visualizations", variant="primary")
    
    with gr.Row():
        outputs = [gr.Image(label=f"Visualization {i+1}", width=600) for i in range(3)]

    submit.click(
        process_file,
        inputs=[api_key, file, instructions],
        outputs=outputs
    )

demo.launch()