Update app.py
Browse files
app.py
CHANGED
@@ -1,34 +1,10 @@
|
|
1 |
-
# app.py
|
2 |
import gradio as gr
|
3 |
from datetime import datetime, timedelta
|
4 |
-
import requests
|
5 |
-
|
6 |
-
def get_subdirectories(url):
|
7 |
-
response = requests.get(url)
|
8 |
-
links = response.text.split('<a href="')
|
9 |
-
subdirectories = [link.split('"')[0] for link in links if link.startswith('/docs/gradio/')]
|
10 |
-
return subdirectories
|
11 |
|
12 |
def generate_release_notes(github_url, github_token, gemini_api_key, start_date, end_date):
|
13 |
-
# Convert start_date and end_date to datetime objects if they're not already
|
14 |
-
if isinstance(start_date, str):
|
15 |
-
start_date = datetime.fromisoformat(start_date).date()
|
16 |
-
elif isinstance(start_date, datetime):
|
17 |
-
start_date = start_date.date()
|
18 |
-
|
19 |
-
if isinstance(end_date, str):
|
20 |
-
end_date = datetime.fromisoformat(end_date).date()
|
21 |
-
elif isinstance(end_date, datetime):
|
22 |
-
end_date = end_date.date()
|
23 |
-
|
24 |
-
# Get subdirectories
|
25 |
-
base_url = "https://www.gradio.app"
|
26 |
-
subdirectories = get_subdirectories(base_url + "/docs/gradio/")
|
27 |
-
full_urls = [base_url + subdir for subdir in subdirectories]
|
28 |
-
|
29 |
# Your existing function implementation here
|
30 |
# ...
|
31 |
-
return f"Generated release notes
|
32 |
|
33 |
# Set default dates
|
34 |
default_end_date = datetime.now()
|
@@ -43,16 +19,19 @@ iface = gr.Interface(
|
|
43 |
gr.Textbox(label="Gemini API Key", type="password"),
|
44 |
gr.Date(
|
45 |
label="Start Date",
|
46 |
-
value=default_start_date.
|
47 |
),
|
48 |
gr.Date(
|
49 |
label="End Date",
|
50 |
-
value=default_end_date.
|
51 |
)
|
52 |
],
|
53 |
outputs=gr.Textbox(label="Generated Release Notes"),
|
54 |
title="Automated Release Notes Generator",
|
55 |
-
description="Generate release notes based on GitHub commits using Gemini AI. Select start and end dates to define the time range for commits."
|
|
|
|
|
|
|
56 |
)
|
57 |
|
58 |
# Launch the app
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from datetime import datetime, timedelta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
def generate_release_notes(github_url, github_token, gemini_api_key, start_date, end_date):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Your existing function implementation here
|
6 |
# ...
|
7 |
+
return f"Generated release notes would appear here. Start Date: {start_date}, End Date: {end_date}"
|
8 |
|
9 |
# Set default dates
|
10 |
default_end_date = datetime.now()
|
|
|
19 |
gr.Textbox(label="Gemini API Key", type="password"),
|
20 |
gr.Date(
|
21 |
label="Start Date",
|
22 |
+
value=default_start_date.strftime("%Y-%m-%d"),
|
23 |
),
|
24 |
gr.Date(
|
25 |
label="End Date",
|
26 |
+
value=default_end_date.strftime("%Y-%m-%d"),
|
27 |
)
|
28 |
],
|
29 |
outputs=gr.Textbox(label="Generated Release Notes"),
|
30 |
title="Automated Release Notes Generator",
|
31 |
+
description="Generate release notes based on GitHub commits using Gemini AI. Select start and end dates to define the time range for commits.",
|
32 |
+
allow_flagging="never",
|
33 |
+
theme="default",
|
34 |
+
analytics_enabled=False,
|
35 |
)
|
36 |
|
37 |
# Launch the app
|