karthickg12 commited on
Commit
c7d3fd1
1 Parent(s): a8ad7fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -73,15 +73,16 @@
73
  # st.success("Thanks for using the app !!!")
74
 
75
  import torch
 
76
  from transformers import AutoModelForCausalLM, AutoTokenizer
77
 
78
  #torch.set_default_device("cuda")
79
 
80
  model = AutoModelForCausalLM.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", torch_dtype="auto", trust_remote_code=True)
81
  tokenizer = AutoTokenizer.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", trust_remote_code=True)
82
-
83
- inputs = tokenizer('''### Instruction: What Does Basic Homeowners Insurance Cover?\n### Response: ''', return_tensors="pt", return_attention_mask=False)
84
-
85
  outputs = model.generate(**inputs, max_length=1024)
86
  text = tokenizer.batch_decode(outputs)[0]
87
  print(text)
 
73
  # st.success("Thanks for using the app !!!")
74
 
75
  import torch
76
+ import streamlit as st
77
  from transformers import AutoModelForCausalLM, AutoTokenizer
78
 
79
  #torch.set_default_device("cuda")
80
 
81
  model = AutoModelForCausalLM.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", torch_dtype="auto", trust_remote_code=True)
82
  tokenizer = AutoTokenizer.from_pretrained("soulhq-ai/phi-2-insurance_qa-sft-lora", trust_remote_code=True)
83
+ i=st.text_input('Prompt', 'Life of Brian')
84
+ #inputs = tokenizer('''### Instruction: What Does Basic Homeowners Insurance Cover?\n### Response: ''', return_tensors="pt", return_attention_mask=False)
85
+ inputs = tokenizer(i, return_tensors="pt", return_attention_mask=False)
86
  outputs = model.generate(**inputs, max_length=1024)
87
  text = tokenizer.batch_decode(outputs)[0]
88
  print(text)