monicacherto commited on
Commit
f52b54a
Β·
1 Parent(s): bb557ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -1,7 +1,18 @@
1
  import gradio as gr
 
 
2
 
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
 
 
 
 
 
 
 
 
 
6
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  iface.launch()
 
1
  import gradio as gr
2
+ import torch
3
+ from peft import PeftModel, PeftConfig
4
 
5
  def greet(name):
6
  return "Hello " + name + "!!"
7
 
8
+ def model_run():
9
+ peft_model_id = f"IThinkUPC/SQLGenerator-AI"
10
+ config = PeftConfig.from_pretrained(peft_model_id)
11
+ model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_8bit=True, device_map='auto')
12
+ tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
13
+ # Load the Lora model
14
+ model = PeftModel.from_pretrained(model, peft_model_id)
15
+
16
+
17
  iface = gr.Interface(fn=greet, inputs="text", outputs="text")
18
  iface.launch()