Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -76,28 +76,13 @@ with gr.Blocks(css=css_style) as demo:
|
|
76 |
""")
|
77 |
|
78 |
openai_api_key = gr.Textbox(
|
79 |
-
|
80 |
-
)
|
81 |
url = gr.Textbox(label="GitHub Repository URL")
|
82 |
model = gr.Dropdown(["gpt-3.5-turbo", "gpt-4"], type="value", label='Model Type')
|
83 |
-
|
84 |
btn = gr.Button("Generate README.md")
|
85 |
-
|
86 |
-
|
87 |
-
output_text = gr.Text()
|
88 |
-
|
89 |
-
def update_output(url, api_key, model):
|
90 |
-
content = generate_repo(url, api_key, model)
|
91 |
-
output_md.update(value=content)
|
92 |
-
output_text.update(value=content)
|
93 |
-
|
94 |
-
btn.click(fn=update_output, inputs=[url, openai_api_key, model], outputs=[])
|
95 |
-
|
96 |
-
with gr.Tabs() as tabs:
|
97 |
-
with gr.TabItem("Rendered Markdown"):
|
98 |
-
output_md
|
99 |
-
with gr.TabItem("Plain Markdown"):
|
100 |
-
output_text
|
101 |
|
102 |
demo.queue(concurrency_count=20)
|
103 |
demo.launch(share=False)
|
|
|
76 |
""")
|
77 |
|
78 |
openai_api_key = gr.Textbox(
|
79 |
+
label="OpenAI API Key", placeholder="sk-...", type="password")
|
|
|
80 |
url = gr.Textbox(label="GitHub Repository URL")
|
81 |
model = gr.Dropdown(["gpt-3.5-turbo", "gpt-4"], type="value", label='Model Type')
|
82 |
+
output = gr.Markdown(label="README.md",show_copy_button=True)
|
83 |
btn = gr.Button("Generate README.md")
|
84 |
+
btn.click(fn=generate_repo, inputs=[url, openai_api_key, model], outputs=[output], api_name="Generate README.md")
|
85 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
demo.queue(concurrency_count=20)
|
88 |
demo.launch(share=False)
|