Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,14 @@
|
|
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 |
# Convert start_date and end_date to datetime objects if they're not already
|
@@ -13,9 +22,14 @@ def generate_release_notes(github_url, github_token, gemini_api_key, start_date,
|
|
13 |
elif isinstance(end_date, datetime):
|
14 |
end_date = end_date.date()
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
# Your existing function implementation here
|
17 |
# ...
|
18 |
-
return f"Generated release notes for {github_url} from {start_date} to {end_date}"
|
19 |
|
20 |
# Set default dates
|
21 |
default_end_date = datetime.now()
|
|
|
1 |
import gradio as gr
|
2 |
from datetime import datetime, timedelta
|
3 |
+
import requests
|
4 |
+
from bs4 import BeautifulSoup
|
5 |
+
|
6 |
+
def get_subdirectories(url):
|
7 |
+
response = requests.get(url)
|
8 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
9 |
+
links = soup.find_all('a')
|
10 |
+
subdirectories = [link['href'] for link in links if link['href'].startswith('/docs/gradio/')]
|
11 |
+
return subdirectories
|
12 |
|
13 |
def generate_release_notes(github_url, github_token, gemini_api_key, start_date, end_date):
|
14 |
# Convert start_date and end_date to datetime objects if they're not already
|
|
|
22 |
elif isinstance(end_date, datetime):
|
23 |
end_date = end_date.date()
|
24 |
|
25 |
+
# Get subdirectories
|
26 |
+
base_url = "https://www.gradio.app"
|
27 |
+
subdirectories = get_subdirectories(base_url + "/docs/gradio/")
|
28 |
+
full_urls = [base_url + subdir for subdir in subdirectories]
|
29 |
+
|
30 |
# Your existing function implementation here
|
31 |
# ...
|
32 |
+
return f"Generated release notes for {github_url} from {start_date} to {end_date}\n\nSubdirectories:\n" + "\n".join(full_urls)
|
33 |
|
34 |
# Set default dates
|
35 |
default_end_date = datetime.now()
|