Spaces:
Sleeping
Sleeping
File size: 5,747 Bytes
8fbbf99 |
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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload File</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
}
.container {
margin-top: 50px;
margin-bottom: 50px;
border-radius: 10px;
background: white;
padding: 30px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
h1, h2 {
color: #343a40;
}
.btn-primary {
background-color: #007bff;
border: none;
}
.btn-primary:hover {
background-color: #0056b3;
}
.img-fluid {
border-radius: 10px;
margin-top: 10px;
}
.form-label {
font-weight: bold;
}
</style>
</head>
<body class="container">
<h1 class="text-center mb-4">Upload CSV or Excel File</h1>
<form action="/result" method="post" enctype="multipart/form-data" class="mb-5">
<div class="mb-3">
<input type="file" name="file" accept=".csv,.xlsx" required class="form-control">
</div>
<div class="mb-3">
<label for="custom_question" class="form-label">Enter custom question for data analysis:</label>
<input type="text" name="custom_question" id="custom_question" required class="form-control">
</div>
<div class="mb-3">
<label for="api_key" class="form-label">Your Google Gemini API Key</label>
<input type="text" name="api_key" id="api_key" required class="form-control" placeholder="Enter your API key">
</div>
<button type="submit" class="btn btn-primary btn-lg btn-block">Upload <i class="fas fa-upload"></i></button>
</form>
{% if response1 and response2 %}
<h2>Google Gemini Response About Data</h2>
<div class="mb-4">
<h3>Plot 1</h3>
<img src="{{ url_for('static', path=plot1_path.split('/')[-1]) }}" alt="Plot 1" class="img-fluid">
<p>{{ response1|safe }}</p>
</div>
<div class="mb-4">
<h3>Plot 2</h3>
<img src="{{ url_for('static', path=plot2_path.split('/')[-1]) }}" alt="Plot 2" class="img-fluid">
<p>{{ response2|safe }}</p>
</div>
{% endif %}
{% if plot1_path or plot2_path or response1 or response2 %}
<a href="{{ url_for('download_pdf') }}" class="btn btn-success mb-5" download>Download Analysis Report PDF <i class="fas fa-file-download"></i></a>
{% endif %}
{% if plot1_path or plot2_path or response1 or response2 %}
<h2>Multiclass Visualization</h2>
<form action="/streamlit" method="post" class="mb-5">
<div class="mb-3">
<label for="target_variable" class="form-label">Select target variable:</label>
<select id="target_variable" name="target_variable" class="form-select">
{% for column in columns %}
<option value="{{ column }}">{{ column }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label for="columns_for_analysis" class="form-label">Select columns for analysis:</label>
<select id="columns_for_analysis" name="columns_for_analysis" multiple class="form-select">
{% for column in columns %}
<option value="{{ column }}">{{ column }}</option>
{% endfor %}
</select>
</div>
<button type="submit" name="process_button" value="Process" class="btn btn-primary">Process <i class="fas fa-cog"></i></button>
</form>
{% endif %}
{% if response3 or response4 %}
<h2>Google Gemini Response About Data</h2>
{% if response3 %}
<div class="mb-4">
<h3>Multiclass Barplot</h3>
<img src="{{ plot3_path }}" alt="Plot 3" class="img-fluid">
<p>{{ response3 }}</p>
</div>
{% endif %}
{% if response4 %}
<div class="mb-4">
<h3>Multiclass Histplot</h3>
<img src="{{ plot4_path }}" alt="Plot 4" class="img-fluid">
<p>{{ response4 }}</p>
</div>
{% endif %}
{% endif %}
{% if plot3_path or plot4_path or response3 or response4 %}
<a href="{{ url_for('download_pdf2') }}" class="btn btn-success mb-5" download>Download Complete Analysis Report PDF <i class="fas fa-file-download"></i></a>
{% endif %}
{% if show_conversation %}
<h3>Conversation</h3>
<form action="/ask" method="post" class="mb-5">
<div class="input-group">
<input type="text" name="question" class="form-control" placeholder="Ask your question..." required>
<button type="submit" class="btn btn-outline-secondary">Ask <i class="fas fa-question-circle"></i></button>
</div>
</form>
{% endif %}
{% if question_responses %}
<h3>Conversation History:</h3>
<ul class="list-group">
{% for question, response in question_responses %}
<li class="list-group-item">
<strong>Question:</strong> {{ question }}<br>
<strong>Response:</strong> {{ response|safe }}
</li>
{% endfor %}
</ul>
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
|