BeastGokul commited on
Commit
67b0b7b
·
verified ·
1 Parent(s): cddca7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -1,17 +1,19 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
- from transformers import pipeline
4
-
5
  """
6
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
7
  """
8
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
9
 
10
- import gradio as gr
 
 
 
11
 
 
 
12
 
13
- # Initialize the pipeline with your fine-tuned biomedical model
14
- pipe = pipeline("text-generation", model="BeastGokul/Bio-Medical-MultiModal-Llama-3-8B-Finetuned")
15
 
16
  def generate_response(chat_history, max_length, temperature, top_p):
17
  conversation = "\n".join([f"User: {msg[0]}\nModel: {msg[1]}" for msg in chat_history if msg[1]])
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
+ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
8
 
9
+ # Load the model and tokenizer manually
10
+ model_name = "BeastGokul/Bio-Medical-MultiModal-Llama-3-8B-Finetuned"
11
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
12
+ model = AutoModelForCausalLM.from_pretrained(model_name)
13
 
14
+ # Create a pipeline using the manually loaded model and tokenizer
15
+ pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
16
 
 
 
17
 
18
  def generate_response(chat_history, max_length, temperature, top_p):
19
  conversation = "\n".join([f"User: {msg[0]}\nModel: {msg[1]}" for msg in chat_history if msg[1]])