Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -5,7 +5,20 @@ model = BioGptForCausalLM.from_pretrained("microsoft/biogpt")
5
  tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt")
6
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
7
  set_seed(42)
 
8
  def predict(text):
9
- return generator(text, max_length=20, num_return_sequences=1, do_sample=True)
10
- interface = gr.Interface(predict, "textbox", "textbox", title="Biogpt", description="Biogpt")
 
 
 
 
 
 
 
 
 
 
 
 
11
  interface.launch()
 
5
  tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt")
6
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
7
  set_seed(42)
8
+
9
  def predict(text):
10
+ return generator(text, max_length=100, num_return_sequences=5, do_sample=True)
11
+
12
+ txt1 = gr.Textbox(
13
+ label="Input",
14
+ lines=5,
15
+ )
16
+
17
+ txt2 = gr.Textbox(
18
+ label="Output",
19
+ lines=20,
20
+ )
21
+
22
+
23
+ interface = gr.Interface(fn=predict, inputs=txt1, outputs=txt2 title="Biogpt", description="Biogpt")
24
  interface.launch()