File size: 4,928 Bytes
174c3d3 b90747c 6b1467b b90747c 8f23e34 b57f297 174c3d3 8f23e34 b90747c b57f297 174c3d3 b90747c 174c3d3 b57f297 174c3d3 8f23e34 b392fc5 c0f87f9 8f23e34 8b8c7d0 8f23e34 8b8c7d0 8f23e34 1e5dd42 8f23e34 6b1467b 8f23e34 8b8c7d0 8f23e34 87fb172 7960667 8f23e34 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
import requests
import gradio as gr
MODAL_API_URL = "https://agents-mcp-hackathon--auto-readme-agent-fastapi-app.modal.run"
def generate_readme(repo_url):
try:
response = requests.post(
MODAL_API_URL,
json={"repo_url": repo_url},
timeout=120
)
if response.status_code == 200:
return response.json().get("result", "No result returned.")
else:
return f"Error: {response.status_code}\n{response.text}"
except Exception as e:
return f"Exception: {str(e)}"
DEFAULT_VALUE = (
"## Hello, World!\n"
"Regardless of the outcome, it was **a truly informative and enjoyable hackathon.** \n"
"As someone who likes and is good at using Hugging Face, I hope there will be more opportunities like this! π€"
)
with gr.Blocks(gr.themes.Origin()) as demo:
gr.HTML("<h1 style='text-align:center;'>π€ ARA: Auto README.md Agent π</h1>")
with gr.Tabs():
with gr.TabItem("README Generator"):
repo_input = gr.Textbox(
label="GitHub Repository URL",
placeholder="Enter the GitHub repository URL (e.g. https://github.com/username/repo)"
)
generate_btn = gr.Button("Generate README.md")
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("### π Draft")
readme_preview = gr.Textbox(
lines=24,
label="Generated by agent",
interactive=True,
value=DEFAULT_VALUE
)
with gr.Column(scale=1):
gr.Markdown("### πΌοΈ Preview")
readme_markdown = gr.Markdown(value=DEFAULT_VALUE, show_copy_button=True)
generate_btn.click(
generate_readme,
inputs=repo_input,
outputs=readme_preview
)
readme_preview.change(
lambda md: md,
inputs=readme_preview,
outputs=readme_markdown
)
with gr.TabItem("Demo Video"):
gr.Markdown("### Demo Video")
gr.Video("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
with gr.TabItem("About"):
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("### Service Description")
gr.Textbox(
value="This service generates README.md files for GitHub repositories using AI agents.",
lines=8,
interactive=False
)
with gr.Column(scale=1):
gr.Markdown("### Features")
gr.Textbox(
value="- Generate README.md from GitHub repo\n- Preview generated README\n- Demo video included",
lines=4,
interactive=False
)
gr.Markdown("### Future Features")
gr.Textbox(
value="- Support for multiple branches\n- Enhanced code analysis\n- User authentication",
lines=4,
interactive=False
)
# with gr.Blocks() as demo:
# gr.HTML("<h1 style='text-align:center;'>π€ ARA: Auto README.md Agent π</h1>")
# repo_input = gr.Textbox(
# label="GitHub Repository URL",
# placeholder="Enter the GitHub repository URL (e.g. https://github.com/username/repo)"
# )
# generate_btn = gr.Button("Generate README.md")
# DEFAULT_VALUE = (
# "## Hello, World!\n"
# "Regardless of the outcome, it was **a truly informative and enjoyable hackathon.** \n"
# "As someone who likes and is good at using Hugging Face, I hope there will be more opportunities like this! π€"
# )
# with gr.Row():
# with gr.Column():
# gr.Markdown("### π Draft")
# readme_preview = gr.Textbox(
# lines=24,
# label="Generated by agent",
# interactive=True,
# value=DEFAULT_VALUE
# )
# with gr.Column():
# gr.Markdown("### πΌοΈ Preview")
# readme_markdown = gr.Markdown(value=DEFAULT_VALUE, show_copy_button=True)
# generate_btn.click(
# generate_readme,
# inputs=repo_input,
# outputs=readme_preview
# )
# readme_preview.change(
# lambda md: md,
# inputs=readme_preview,
# outputs=readme_markdown
# )
if __name__ == "__main__":
demo.launch()
#Error: 422
#{"detail":[{"type":"missing","loc":["body","repo_url"],"msg":"Field required","input":{"query":"https://github.com/nsbg/nsbg.github.io"}}]} |