Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,28 @@ HTML_TEMPLATE = """
|
|
| 29 |
<title>AI README Generator 🧠</title>
|
| 30 |
<style>
|
| 31 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
|
| 32 |
-
body {
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
h1 { font-size: 2.2em; color: #1877f2; margin-bottom: 10px; }
|
| 35 |
p { color: #606770; font-size: 1.1em; margin-bottom: 30px; }
|
| 36 |
.input-group { display: flex; margin-bottom: 20px; }
|
|
@@ -42,6 +62,22 @@ HTML_TEMPLATE = """
|
|
| 42 |
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
| 43 |
#result-container { display: none; margin-top: 20px; }
|
| 44 |
#result { margin-top: 10px; padding: 20px; background-color: #f7f7f7; border: 1px solid #dddfe2; border-radius: 6px; text-align: left; white-space: pre-wrap; font-family: 'Courier New', Courier, monospace; max-height: 400px; overflow-y: auto; word-wrap: break-word; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
</style>
|
| 46 |
</head>
|
| 47 |
<body>
|
|
@@ -52,6 +88,12 @@ HTML_TEMPLATE = """
|
|
| 52 |
<div class="loader" id="loader"></div>
|
| 53 |
<div id="result-container"><h2>Generated README.md:</h2><pre id="result"></pre></div>
|
| 54 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
<script>
|
| 56 |
document.getElementById('repo-form').addEventListener('submit', async function(event) {
|
| 57 |
event.preventDefault();
|
|
@@ -119,8 +161,8 @@ def generate_readme_with_llm(repo_path):
|
|
| 119 |
|
| 120 |
try:
|
| 121 |
print("Step 5: Sending request to Gemini API...")
|
| 122 |
-
# ---
|
| 123 |
-
model = genai.GenerativeModel('gemini-
|
| 124 |
|
| 125 |
response = model.generate_content(prompt)
|
| 126 |
print("Step 6: Received response from Gemini API.")
|
|
|
|
| 29 |
<title>AI README Generator 🧠</title>
|
| 30 |
<style>
|
| 31 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
|
| 32 |
+
body {
|
| 33 |
+
font-family: 'Inter', sans-serif;
|
| 34 |
+
background-color: #f0f2f5;
|
| 35 |
+
color: #1c1e21;
|
| 36 |
+
margin: 0;
|
| 37 |
+
display: flex;
|
| 38 |
+
flex-direction: column; /* Align container and footer vertically */
|
| 39 |
+
justify-content: center;
|
| 40 |
+
align-items: center;
|
| 41 |
+
min-height: 100vh;
|
| 42 |
+
padding: 20px;
|
| 43 |
+
box-sizing: border-box;
|
| 44 |
+
}
|
| 45 |
+
.container {
|
| 46 |
+
background-color: #ffffff;
|
| 47 |
+
padding: 40px 50px;
|
| 48 |
+
border-radius: 12px;
|
| 49 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
| 50 |
+
width: 100%;
|
| 51 |
+
max-width: 700px;
|
| 52 |
+
text-align: center;
|
| 53 |
+
}
|
| 54 |
h1 { font-size: 2.2em; color: #1877f2; margin-bottom: 10px; }
|
| 55 |
p { color: #606770; font-size: 1.1em; margin-bottom: 30px; }
|
| 56 |
.input-group { display: flex; margin-bottom: 20px; }
|
|
|
|
| 62 |
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
| 63 |
#result-container { display: none; margin-top: 20px; }
|
| 64 |
#result { margin-top: 10px; padding: 20px; background-color: #f7f7f7; border: 1px solid #dddfe2; border-radius: 6px; text-align: left; white-space: pre-wrap; font-family: 'Courier New', Courier, monospace; max-height: 400px; overflow-y: auto; word-wrap: break-word; }
|
| 65 |
+
|
| 66 |
+
/* --- Footer Styles --- */
|
| 67 |
+
footer {
|
| 68 |
+
margin-top: 25px;
|
| 69 |
+
text-align: center;
|
| 70 |
+
font-size: 0.9em;
|
| 71 |
+
color: #8a8d91;
|
| 72 |
+
}
|
| 73 |
+
footer a {
|
| 74 |
+
color: #1877f2;
|
| 75 |
+
text-decoration: none;
|
| 76 |
+
font-weight: 600;
|
| 77 |
+
}
|
| 78 |
+
footer a:hover {
|
| 79 |
+
text-decoration: underline;
|
| 80 |
+
}
|
| 81 |
</style>
|
| 82 |
</head>
|
| 83 |
<body>
|
|
|
|
| 88 |
<div class="loader" id="loader"></div>
|
| 89 |
<div id="result-container"><h2>Generated README.md:</h2><pre id="result"></pre></div>
|
| 90 |
</div>
|
| 91 |
+
|
| 92 |
+
<!-- --- Footer --- -->
|
| 93 |
+
<footer>
|
| 94 |
+
<p>Made with ❤️ by <a href="https://asadfaizee.is-a.dev/" target="_blank" rel="noopener noreferrer">Asad Faizee</a></p>
|
| 95 |
+
</footer>
|
| 96 |
+
|
| 97 |
<script>
|
| 98 |
document.getElementById('repo-form').addEventListener('submit', async function(event) {
|
| 99 |
event.preventDefault();
|
|
|
|
| 161 |
|
| 162 |
try:
|
| 163 |
print("Step 5: Sending request to Gemini API...")
|
| 164 |
+
# --- Corrected the model name ---
|
| 165 |
+
model = genai.GenerativeModel('gemini-1.5-flash')
|
| 166 |
|
| 167 |
response = model.generate_content(prompt)
|
| 168 |
print("Step 6: Received response from Gemini API.")
|