chiranthkg06 commited on
Commit
3719dc9
·
verified ·
1 Parent(s): a47f135

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,9 +1,14 @@
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
 
 
4
  model_name = "QuantFactory/Meta-Llama-3-8B-Instruct-GGUF"
5
- model = AutoModelForCausalLM.from_pretrained(model_name)
6
- tokenizer = AutoTokenizer.from_pretrained(model_name)
 
 
 
 
7
 
8
  def generate_response(prompt):
9
  inputs = tokenizer(prompt, return_tensors="pt")
@@ -13,3 +18,4 @@ def generate_response(prompt):
13
 
14
  interface = gr.Interface(fn=generate_response, inputs="text", outputs="text")
15
  interface.launch()
 
 
1
  import gradio as gr
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
 
4
+ # Ensure the correct model path
5
  model_name = "QuantFactory/Meta-Llama-3-8B-Instruct-GGUF"
6
+
7
+ try:
8
+ model = AutoModelForCausalLM.from_pretrained(model_name)
9
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
10
+ except OSError as e:
11
+ print(f"Error loading the model: {e}")
12
 
13
  def generate_response(prompt):
14
  inputs = tokenizer(prompt, return_tensors="pt")
 
18
 
19
  interface = gr.Interface(fn=generate_response, inputs="text", outputs="text")
20
  interface.launch()
21
+