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()