File size: 646 Bytes
0618b06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

# Load model directly
from transformers import pipeline
import gradio as gr
import torch
 
# Check if CUDA is available, otherwise use CPU
device = "cuda" if torch.cuda.is_available() else "cpu"

pipe = pipeline("text-generation", model="microsoft/BioGPT-Large", device=device)

def question(message, history):


    # Generate the response
    response = pipe(message, max_length=200)[0]['generated_text'] 

    return response

#Description in Markdown
description = 



program = gr.ChatInterface(question,description=description,title="Microsoft BioGPT Large Chat")

if __name__ == "__main__":
    program.launch()