Spaces:
Sleeping
Sleeping
File size: 614 Bytes
54b2eb1 0ccc2c4 54b2eb1 0ccc2c4 f663a08 54b2eb1 0ccc2c4 f663a08 54b2eb1 0ccc2c4 f663a08 0ccc2c4 |
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 |
import gradio as gr
from transformers import pipeline
# Load BioGPT model
bio_gpt = pipeline("text-generation", model="microsoft/biogpt-large")
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()
|