Noveramaaz commited on
Commit
3bfc85c
·
verified ·
1 Parent(s): 688f77e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,8 +1,11 @@
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
 
4
- # Load the model and tokenizer from Hugging Face's model hub
5
- model = AutoModelForCausalLM.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
 
 
 
6
  tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
7
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
8
 
@@ -25,3 +28,4 @@ iface = gr.Interface(
25
 
26
  if __name__ == "__main__":
27
  iface.launch()
 
 
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3
 
4
+ # Load the model and tokenizer from Hugging Face's model hub with trust_remote_code=True
5
+ model = AutoModelForCausalLM.from_pretrained(
6
+ "microsoft/Phi-3-mini-4k-instruct",
7
+ trust_remote_code=True # Allow custom code execution
8
+ )
9
  tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
10
  pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
11
 
 
28
 
29
  if __name__ == "__main__":
30
  iface.launch()
31
+