RashiAgarwal commited on
Commit
d8ff530
1 Parent(s): b44d7d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -18
app.py CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
5
 
6
  model_name = "microsoft/phi-2"
7
  model = AutoModelForCausalLM.from_pretrained(
8
- model_name, low_cpu_mem_usage=True,
9
  trust_remote_code=True
10
  )
11
  model.config.use_cache = False
@@ -26,24 +26,9 @@ def inference(prompt):
26
  result = pipe(f"<s>[INST] {prompt} [/INST]")
27
  return result[0]['generated_text']
28
 
29
- INTERFACE = gr.Interface(fn=inference, inputs=[gr.Textbox(label= "Prompt", value= 'write a note on Shakuntala Devi')],
30
 
31
  outputs=gr.Text(label= "Generated Text"), title="Language Model Phi-2 fine-tuned with OpenAssistant/oasst-1 dataset using QLoRA strategy",
32
 
33
  examples = [['explain transpiration in plants'],]
34
- ).launch(debug=True)
35
-
36
- # with gr.Blocks() as demo:
37
-
38
- # gr.Markdown(
39
- # """
40
- # # Phi2 trained on OpenAssistant/oasst1 dataset
41
- # Start typing below to see the output.
42
- # """)
43
- # prompt = gr.Textbox(label="Prompt")
44
- # output = gr.Textbox(label="Output Box")
45
- # greet_btn = gr.Button("Generate")
46
- # examples = gr.Examples(examples=['write a note on Shakuntala Devi'], ['Tell me about Amitabh Bachchan'], inputs = [prompt], cache_examples=False)
47
- # greet_btn.click(fn=inference, inputs=prompt, outputs=output)
48
-
49
- # demo.launch(debug=True)
 
5
 
6
  model_name = "microsoft/phi-2"
7
  model = AutoModelForCausalLM.from_pretrained(
8
+ model_name,
9
  trust_remote_code=True
10
  )
11
  model.config.use_cache = False
 
26
  result = pipe(f"<s>[INST] {prompt} [/INST]")
27
  return result[0]['generated_text']
28
 
29
+ INTERFACE = gr.Interface(fn=inference, inputs=[gr.Textbox(label= "Prompt", value= 'what should we do to save time')],
30
 
31
  outputs=gr.Text(label= "Generated Text"), title="Language Model Phi-2 fine-tuned with OpenAssistant/oasst-1 dataset using QLoRA strategy",
32
 
33
  examples = [['explain transpiration in plants'],]
34
+ ).launch(debug=True)