bala1802 commited on
Commit
529bc21
1 Parent(s): fd12adc

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ import model_utils
4
+ import inference
5
+
6
+ tokenizer = model_utils.load_tokenizers()
7
+ tokenizer.pad_token = tokenizer.eos_token
8
+
9
+ model = model_utils.load_model(quantization_config=None)
10
+ adapter = "model/checkpoint-700/"
11
+ model.load_adapter(adapter)
12
+
13
+ def generated_text(prompt):
14
+ result = inference.predict(prompt=prompt, model=model, tokenizer=tokenizer, max_length=200)
15
+ return result
16
+
17
+ iface = gr.Interface(
18
+ fn = generated_text,
19
+ inputs = gr.Textbox(),
20
+ outputs = gr.Textbox(),
21
+ theme="dark",
22
+ title="Phi-2 Finetuned Model. For more visit: https://github.com/bala1802/Phi2"
23
+ )
24
+
25
+ iface.launch(share=True)