yasserrmd commited on
Commit
3ca495f
1 Parent(s): 90e00d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -24,10 +24,10 @@ def generate_documentation(code_input):
24
  model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
25
 
26
  # Generate the documentation
27
- generated_ids = model.generate(**model_inputs, max_new_tokens=512)
28
  generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
29
  documentation = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
30
-
31
  return documentation
32
 
33
  # Function to generate and download PDF
@@ -52,7 +52,7 @@ def process_code(code_input):
52
  # Set up the Gradio app with Bootstrap, icons, and smiley
53
  with gr.Blocks(css=".container { font-family: 'Roboto', sans-serif; } .btn-primary { background-color: #007bff; } .icon { margin-right: 10px; }") as app:
54
  gr.Markdown("""
55
- # :notebook_with_decorative_cover: Code Documentation Generator
56
 
57
  Paste your code below, and the app will generate the README and detailed documentation for you.
58
  The output will also be available for download as a PDF.
@@ -62,7 +62,7 @@ with gr.Blocks(css=".container { font-family: 'Roboto', sans-serif; } .btn-prima
62
  code_input = gr.Textbox(lines=10, label="Paste your code here", placeholder="Enter your code...", show_label=False, elem_classes="form-control")
63
 
64
  with gr.Row():
65
- generate_button = gr.Button(":sparkles: Generate Documentation", elem_classes="btn btn-primary")
66
 
67
  with gr.Row():
68
  output_text = gr.Textbox(label="Generated Documentation", lines=20, interactive=False)
 
24
  model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
25
 
26
  # Generate the documentation
27
+ generated_ids = model.generate(**model_inputs, max_new_tokens=4000)
28
  generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
29
  documentation = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
30
+ print(documentation)
31
  return documentation
32
 
33
  # Function to generate and download PDF
 
52
  # Set up the Gradio app with Bootstrap, icons, and smiley
53
  with gr.Blocks(css=".container { font-family: 'Roboto', sans-serif; } .btn-primary { background-color: #007bff; } .icon { margin-right: 10px; }") as app:
54
  gr.Markdown("""
55
+ #Code Documentation Generator
56
 
57
  Paste your code below, and the app will generate the README and detailed documentation for you.
58
  The output will also be available for download as a PDF.
 
62
  code_input = gr.Textbox(lines=10, label="Paste your code here", placeholder="Enter your code...", show_label=False, elem_classes="form-control")
63
 
64
  with gr.Row():
65
+ generate_button = gr.Button("Generate Documentation", elem_classes="btn btn-primary")
66
 
67
  with gr.Row():
68
  output_text = gr.Textbox(label="Generated Documentation", lines=20, interactive=False)