File size: 726 Bytes
ab86870 8937d91 ab86870 8937d91 ab86870 8937d91 ab86870 8937d91 ab86870 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from transformers import pipeline
# Load the question-answering model
model = pipeline("question-answering", model="Rishitha0208/new-llm-for-advanced-materials")
def answer_question(question):
# Generate an answer from the model
result = model(question=question, context="") # Provide an empty context if not required
return result['answer']
# Define the Gradio interface
interface = gr.Interface(
fn=answer_question,
inputs=gr.Textbox(lines=2, placeholder="Enter your question here...", label="Question"),
outputs="text",
title="Polymer Knowledge Model",
description="A model fine-tuned to answer questions about polymers."
)
# Launch the interface
interface.launch()
|