BioGPT / app.py
Praisepaul's picture
Update app.py
bd90ad6 verified
raw
history blame
608 Bytes
import gradio as gr
from transformers import pipeline
# Load BioGPT model
bio_gpt = pipeline("text-generation", model="microsoft/biogpt")
def medical_chatbot(query):
# Generate text using BioGPT
result = bio_gpt(query, max_length=100, num_return_sequences=1)
# Extract only the generated text from response
generated_text = result[0]["generated_text"]
return generated_text
# Create Gradio interface
iface = gr.Interface(
fn=medical_chatbot,
inputs=gr.Textbox(placeholder="Ask me a medical question..."),
outputs="text",
title="Medical Chatbot"
)
iface.launch()