haramkoo commited on
Commit
d3c3cdf
·
1 Parent(s): ebf951c

webapp update 03-07-2022 6:09 pm

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import BartForConditionalGeneration, BartTokenizer
3
+
4
+ model = BartForConditionalGeneration.from_pretrained("hyechanjun/interview-question-remake")
5
+ tok = BartTokenizer.from_pretrained("hyechanjun/interview-question-remake")
6
+
7
+ def genQuestion(context):
8
+ inputs = tok.tokenize(context, return_tensors="pt")
9
+ output = model.generate(inputs["input_ids"], num_beams=4, max_length=64)
10
+
11
+ return tok.batch_decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=False)
12
+
13
+ iface = gr.Interface(fn=genQuestion, inputs="text", outputs="text")
14
+ iface.launch()