cristinaimprota commited on
Commit
c146e6c
·
verified ·
1 Parent(s): e733d81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -22,6 +22,14 @@ model = AutoModelForCausalLM.from_pretrained(
22
  model.to(device)
23
  model.eval()
24
 
 
 
 
 
 
 
 
 
25
 
26
  # ==========================
27
  # Prompt builder
@@ -105,10 +113,20 @@ with gr.Blocks(title="Python Code Generator") as demo:
105
  with gr.Column(scale=2):
106
  instruction_input = gr.Textbox(
107
  label="Instruction",
108
- placeholder="Describe the code you want. E.g., 'Write a Python function that checks if a number is prime.'",
 
 
 
109
  lines=4,
110
  )
111
 
 
 
 
 
 
 
 
112
  is_first = gr.State(True)
113
 
114
  submit_btn = gr.Button("Generate Code")
 
22
  model.to(device)
23
  model.eval()
24
 
25
+ # ==========================
26
+ # Example prompt from the paper
27
+ # ==========================
28
+
29
+ PAPER_PROMPT = (
30
+ "def hash_(listing_id):\n"
31
+ " \"\"\"Creates an hashed column using the listing id for the vehicle\"\"\"\n"
32
+ )
33
 
34
  # ==========================
35
  # Prompt builder
 
113
  with gr.Column(scale=2):
114
  instruction_input = gr.Textbox(
115
  label="Instruction",
116
+ placeholder=(
117
+ "Describe the code you want. "
118
+ "E.g., 'Write a Python function that checks if a number is prime.'"
119
+ ),
120
  lines=4,
121
  )
122
 
123
+ # 🔹 Example prompt from the paper (click to fill the textbox)
124
+ gr.Examples(
125
+ examples=[[PAPER_PROMPT]],
126
+ inputs=[instruction_input],
127
+ label="Try the paper's hash_ example",
128
+ )
129
+
130
  is_first = gr.State(True)
131
 
132
  submit_btn = gr.Button("Generate Code")