Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,9 +56,12 @@ def generate_repo(url, api_key, model):
|
|
| 56 |
# print("Access to GPT-4 confirmed!")
|
| 57 |
# except:
|
| 58 |
# return "The API key either does not have access to GPT-4 or is not valid."
|
| 59 |
-
return process_repository(url, model)
|
| 60 |
else:
|
| 61 |
-
return "Please add a valid OpenAI API Key (you can get them [here](https://platform.openai.com/account/api-keys))"
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
with gr.Blocks(css=css_style) as demo:
|
| 64 |
gr.Markdown(f"""
|
|
@@ -79,10 +82,18 @@ with gr.Blocks(css=css_style) as demo:
|
|
| 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 |
-
|
| 83 |
btn = gr.Button("Generate README.md")
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
|
| 87 |
-
demo.queue(concurrency_count=20)
|
| 88 |
demo.launch(share=False)
|
|
|
|
| 56 |
# print("Access to GPT-4 confirmed!")
|
| 57 |
# except:
|
| 58 |
# return "The API key either does not have access to GPT-4 or is not valid."
|
| 59 |
+
return update_md(process_repository(url, model))
|
| 60 |
else:
|
| 61 |
+
return "Please add a valid OpenAI API Key (you can get them [here](https://platform.openai.com/account/api-keys))","Please add a valid OpenAI API Key (you can get them [here](https://platform.openai.com/account/api-keys))"
|
| 62 |
+
|
| 63 |
+
def update_md(output):
|
| 64 |
+
return f"GPT4Readability Generated README.md File:\n\n{output}", f"{output}"
|
| 65 |
|
| 66 |
with gr.Blocks(css=css_style) as demo:
|
| 67 |
gr.Markdown(f"""
|
|
|
|
| 82 |
label="OpenAI API Key", placeholder="sk-...", type="password")
|
| 83 |
url = gr.Textbox(label="GitHub Repository URL")
|
| 84 |
model = gr.Dropdown(["gpt-3.5-turbo", "gpt-4"], type="value", label='Model Type')
|
| 85 |
+
|
| 86 |
btn = gr.Button("Generate README.md")
|
| 87 |
+
|
| 88 |
+
with gr.Tab("Rendered README.md"):
|
| 89 |
+
output_rendered = gr.Markdown()
|
| 90 |
+
|
| 91 |
+
with gr.Tab("Plain Text for Copying README.md!"):
|
| 92 |
+
plain_output = gr.Textbox(show_copy_button=True, lines=100, max_lines=1000)
|
| 93 |
+
|
| 94 |
+
# Link button click event to outputs
|
| 95 |
+
btn.click(fn=generate_repo, inputs=[url, openai_api_key, model],
|
| 96 |
+
outputs=[output_rendered, plain_output])
|
| 97 |
|
| 98 |
|
|
|
|
| 99 |
demo.launch(share=False)
|