Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ def generate_documentation(code_input):
|
|
16 |
prompt = f"Generate README for the following code:\n\n{code_input}"
|
17 |
|
18 |
messages = [
|
19 |
-
{"role": "system", "content": "You are
|
20 |
{"role": "user", "content": prompt}
|
21 |
]
|
22 |
|
@@ -35,13 +35,13 @@ def generate_documentation(code_input):
|
|
35 |
# Gradio interface
|
36 |
def process_code(code_input):
|
37 |
documentation = generate_documentation(code_input)
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
41 |
|
42 |
-
return documentation,
|
43 |
|
44 |
-
# Set up the Gradio app with Bootstrap, icons, and smiley
|
45 |
with gr.Blocks(css=".container { font-family: 'Roboto', sans-serif; } .btn-primary { background-color: #007bff; } .icon { margin-right: 10px; }") as app:
|
46 |
gr.Markdown("""
|
47 |
#Code Documentation Generator
|
|
|
16 |
prompt = f"Generate README for the following code:\n\n{code_input}"
|
17 |
|
18 |
messages = [
|
19 |
+
{"role": "system", "content": "You are ReadMe Forge, a highly efficient and intelligent assistant designed to analyze code and generate comprehensive, clear, and concise documentation. Your purpose is to help developers by producing well-structured README files and detailed explanations of their code. You aim to simplify complex code into easily understandable documentation, ensuring that your responses are accurate, professional, and easy to follow."},
|
20 |
{"role": "user", "content": prompt}
|
21 |
]
|
22 |
|
|
|
35 |
# Gradio interface
|
36 |
def process_code(code_input):
|
37 |
documentation = generate_documentation(code_input)
|
38 |
+
# Save the documentation to a README.md file
|
39 |
+
file_path = "README.md"
|
40 |
+
with open(file_path, 'w', encoding='utf-8') as readme_file:
|
41 |
+
readme_file.write(documentation)
|
42 |
|
43 |
+
return documentation, file_path
|
44 |
|
|
|
45 |
with gr.Blocks(css=".container { font-family: 'Roboto', sans-serif; } .btn-primary { background-color: #007bff; } .icon { margin-right: 10px; }") as app:
|
46 |
gr.Markdown("""
|
47 |
#Code Documentation Generator
|