Mr-Vicky-01 commited on
Commit
8384fe4
1 Parent(s): d06e5ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -1,15 +1,16 @@
1
- from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
  import gradio as gr
3
 
4
  checkpoint = "Mr-Vicky-01/Bart-Finetuned-conversational-summarization"
5
 
6
- tokenizer = AutoTokenizer.from_pretrained(checkpoint)
7
- model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
 
 
 
8
 
9
  def generate_summary(text):
10
- inputs = tokenizer([text], max_length=1024, return_tensors='pt', truncation=True)
11
- summary_ids = model.generate(inputs['input_ids'], max_new_tokens=100, do_sample=False)
12
- summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
13
  return summary
14
 
15
  examples = [
 
1
+ from langchain import HuggingFaceHub
2
  import gradio as gr
3
 
4
  checkpoint = "Mr-Vicky-01/Bart-Finetuned-conversational-summarization"
5
 
6
+ model = HuggingFaceHub(repo_id=checkpoint,
7
+ model_kwargs={"temperature":0.1,
8
+ "max_new_tokens":100,
9
+ "do_sample":False
10
+ })
11
 
12
  def generate_summary(text):
13
+ summary = model(text)
 
 
14
  return summary
15
 
16
  examples = [