RashiAgarwal commited on
Commit
d0e6c3b
1 Parent(s): eaa8416

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -15,10 +15,10 @@ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
15
  tokenizer.pad_token = tokenizer.eos_token
16
 
17
  # Loading adapter (trained LORA weights)
18
- ckpt = '/content/drive/MyDrive/S27/results/checkpoint-500'
19
- model.load_adapter(ckpt)
20
- # adapter_path = 'checkpoint-500'
21
- # model.load_adapter(adapter_path)
22
 
23
  def inference(prompt):
24
 
@@ -27,9 +27,15 @@ def inference(prompt):
27
  return result[0]['generated_text']
28
 
29
  with gr.Blocks() as demo:
 
 
 
 
 
 
30
  prompt = gr.Textbox(label="Prompt")
31
  output = gr.Textbox(label="Output Box")
32
  greet_btn = gr.Button("Generate")
33
- greet_btn.click(fn=inference, inputs=prompt, outputs=output, api_name="inference")
34
 
35
- demo.launch()
 
15
  tokenizer.pad_token = tokenizer.eos_token
16
 
17
  # Loading adapter (trained LORA weights)
18
+ # ckpt = '/content/drive/MyDrive/S27/results/checkpoint-500'
19
+ # model.load_adapter(ckpt)
20
+ adapter_path = 'checkpoint-500'
21
+ model.load_adapter(adapter_path)
22
 
23
  def inference(prompt):
24
 
 
27
  return result[0]['generated_text']
28
 
29
  with gr.Blocks() as demo:
30
+
31
+ gr.Markdown(
32
+ """
33
+ # Phi2 trained on OpenAssistant/oasst1 dataset
34
+ Start typing below to see the output.
35
+ """)
36
  prompt = gr.Textbox(label="Prompt")
37
  output = gr.Textbox(label="Output Box")
38
  greet_btn = gr.Button("Generate")
39
+ greet_btn.click(fn=inference, inputs=prompt, outputs=output)
40
 
41
+ demo.launch(debug=True)