added app.py file
Browse files
app.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from github_analyzer import analyze_repo
|
| 3 |
+
from readme_generator import generate_readme
|
| 4 |
+
from azure_ai import enhance_with_ai
|
| 5 |
+
from license_generator import generate_license
|
| 6 |
+
|
| 7 |
+
def generate(repo_url, username, license_type):
|
| 8 |
+
repo_info = analyze_repo(repo_url)
|
| 9 |
+
ai_summary = enhance_with_ai(repo_info)
|
| 10 |
+
selected_license = generate_license(license_type, username)
|
| 11 |
+
generate_readme(repo_info, ai_summary, license_type=selected_license)
|
| 12 |
+
|
| 13 |
+
with open("readme.md", "r", encoding="utf-8") as f:
|
| 14 |
+
readme_content = f.read()
|
| 15 |
+
with open("LICENSE", "r", encoding="utf-8") as f:
|
| 16 |
+
license_content = f.read()
|
| 17 |
+
|
| 18 |
+
return readme_content, license_content
|
| 19 |
+
|
| 20 |
+
iface = gr.Interface(
|
| 21 |
+
fn=generate,
|
| 22 |
+
inputs=[
|
| 23 |
+
gr.Textbox(label="Repository URL"),
|
| 24 |
+
gr.Textbox(label="Username"),
|
| 25 |
+
gr.Dropdown(["MIT", "Apache-2.0", "GPL-3.0", "BSD-3-Clause"], label="License Type")
|
| 26 |
+
],
|
| 27 |
+
outputs=[
|
| 28 |
+
gr.Textbox(label="Generated README", lines=20),
|
| 29 |
+
gr.Textbox(label="Generated LICENSE", lines=20)
|
| 30 |
+
],
|
| 31 |
+
title="Auto README & License Generator",
|
| 32 |
+
description="Enter a GitHub repo, username, and choose a license to auto-generate README and LICENSE files."
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
if __name__ == "__main__":
|
| 36 |
+
iface.launch(debug=True,server_name="0.0.0.0",server_port=7860,pwa=True)
|