yasserrmd commited on
Commit
df9ab20
1 Parent(s): 6f7e0d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -3,6 +3,8 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
3
  from fpdf import FPDF
4
  import torch
5
  import spaces
 
 
6
 
7
  # Initialize the Qwen model and tokenizer
8
  model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
@@ -28,7 +30,7 @@ def generate_documentation(code_input):
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
34
  def create_pdf(documentation):
 
3
  from fpdf import FPDF
4
  import torch
5
  import spaces
6
+ import io
7
+ import markdown
8
 
9
  # Initialize the Qwen model and tokenizer
10
  model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
 
30
  generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
31
  documentation = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
32
  print(documentation)
33
+ return markdown.markdown(documentation)
34
 
35
  # Function to generate and download PDF
36
  def create_pdf(documentation):