nafisneehal commited on
Commit
47db4ab
·
verified ·
1 Parent(s): 09825e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import torch
3
  from peft import AutoPeftModelForCausalLM
4
  from transformers import AutoTokenizer, GenerationConfig
 
5
 
6
  # Load model and tokenizer
7
  model_name = "nafisneehal/Llama-3.2-3B-bnb-4bit-finetuned-TrialBrain-BaselineFeatures-it"
@@ -67,6 +68,7 @@ PRIOR CONCURRENT THERAPY:
67
  """
68
 
69
  # Function to generate response
 
70
  def generate_response(system_instruction, user_input):
71
  # Prepare the input and move it to the correct device
72
  inputs = tokenizer([f"### Instruction:\n{system_instruction}\n### Input:\n{user_input}\n### Response:\n"], return_tensors="pt").to(device)
 
2
  import torch
3
  from peft import AutoPeftModelForCausalLM
4
  from transformers import AutoTokenizer, GenerationConfig
5
+ import spaces
6
 
7
  # Load model and tokenizer
8
  model_name = "nafisneehal/Llama-3.2-3B-bnb-4bit-finetuned-TrialBrain-BaselineFeatures-it"
 
68
  """
69
 
70
  # Function to generate response
71
+ @spaces.GPU
72
  def generate_response(system_instruction, user_input):
73
  # Prepare the input and move it to the correct device
74
  inputs = tokenizer([f"### Instruction:\n{system_instruction}\n### Input:\n{user_input}\n### Response:\n"], return_tensors="pt").to(device)