Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,6 @@ from utils import lang_ids
|
|
5 |
import gradio as gr
|
6 |
import torch
|
7 |
|
8 |
-
device = torch.device('cuda:0')
|
9 |
-
|
10 |
biogpt_model_list = [
|
11 |
"microsoft/biogpt",
|
12 |
"microsoft/BioGPT-Large",
|
@@ -40,7 +38,7 @@ def biogpt(
|
|
40 |
en_prompt = translate_to_english(prompt, lang_model_id, base_lang)
|
41 |
model = BioGptForCausalLM.from_pretrained(biogpt_model_id)
|
42 |
tokenizer = BioGptTokenizer.from_pretrained(biogpt_model_id)
|
43 |
-
generator = pipeline('text-generation', model=model, tokenizer=tokenizer, device=
|
44 |
set_seed(42)
|
45 |
output = generator(en_prompt, max_length=max_length, num_return_sequences=num_return_sequences, do_sample=True)
|
46 |
output_dict = {}
|
|
|
5 |
import gradio as gr
|
6 |
import torch
|
7 |
|
|
|
|
|
8 |
biogpt_model_list = [
|
9 |
"microsoft/biogpt",
|
10 |
"microsoft/BioGPT-Large",
|
|
|
38 |
en_prompt = translate_to_english(prompt, lang_model_id, base_lang)
|
39 |
model = BioGptForCausalLM.from_pretrained(biogpt_model_id)
|
40 |
tokenizer = BioGptTokenizer.from_pretrained(biogpt_model_id)
|
41 |
+
generator = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
|
42 |
set_seed(42)
|
43 |
output = generator(en_prompt, max_length=max_length, num_return_sequences=num_return_sequences, do_sample=True)
|
44 |
output_dict = {}
|