github-release / app.py
LysandreJik's picture
First version
d80253f
raw
history blame
1.13 kB
import gradio as gr
from graphql_calls import get_tag_commit_date, get_commits
def get_all_commits(token, repo, tag, branch):
date = get_tag_commit_date(token, repo, tag)
commits = get_commits(token, repo, date)
result = ''
for commit in commits:
if '(#' in commit.message:
split = commit.message.split('(#')
message = split[0]
number = split[1].strip(')')
result += f"* {message} by @{commit.user} in #{number}\n"
else:
result += f"* {commit.message} by @{commit.user} (direct commit on {branch})\n"
return result
demo = gr.Interface(
fn=get_all_commits,
inputs=[
gr.inputs.Textbox(lines=1, placeholder="Your GitHub token"),
gr.inputs.Textbox(lines=1, placeholder="Repository", default='huggingface/transformers'),
gr.inputs.Textbox(lines=1, placeholder="The tag from which to get commit"),
gr.inputs.Textbox(lines=1, placeholder="The linear branch on which the new version tag will be added", default='main'),
],
outputs='text',
)
if __name__ == "__main__":
demo.launch()