avciTheProgrammer commited on
Commit
23baa65
·
verified ·
1 Parent(s): a4e0a36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -32,7 +32,13 @@ def generate_code(prompt):
32
  temperature=0.7
33
  )
34
 
35
- return tokenizer.decode(outputs[0], skip_special_tokens=True)
 
 
 
 
 
 
36
 
37
  demo = gr.Interface(
38
  fn=generate_code,
 
32
  temperature=0.7
33
  )
34
 
35
+ output_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
36
+
37
+ # Strip the prompt if it appears at the start
38
+ if output_text.startswith(prompt):
39
+ output_text = output_text[len(prompt):].lstrip()
40
+
41
+ return output_text
42
 
43
  demo = gr.Interface(
44
  fn=generate_code,