AbstractAI / app.py
rajj0's picture
Update app.py
0be83ad
import gradio as gr
import transformers
from transformers import pipeline
from peft import PeftModel
#prompt = f"[INST] Generate abstract for the key points\n1. Chimera Design: The design of Chimera is broken into a core and extensions. The core provides basic services and visualization, while the extensions are responsible for higher level functionality, allowing third-party developers to incorporate new features according to their needs.\n2. Multiscale Extension: The Multiscale extension of Chimera allows users to visualize large-scale molecular assemblies such as viral coats. By providing a scale-based approach, it enhances the understanding of molecular structures and interactions in biological research.\n3. Collaboratory Extension: Offering the ability for researchers based in different locations to share a Chimera session interactively, the Collaboratory extension significantly improves collaboration capacity. Through this shared environment, researchers can conduct simultaneous examinations and share insights in real-time.\n4. Other Extensions: Other extensions such as Multalign Viewer, ViewDock, Movie, and Volume Viewer offer a diverse set of features. They allow the display of multiple sequence alignments, screening of docked ligand orientations, replay of molecular dynamics trajectories, and analysis of volumetric data respectively.\n5. Real-World Usage of Chimera: The abstract also discusses the practical usage of Chimera in real-world situations, pointing out its wide applicability and impact in the field of molecular biology and bioinformatics \n . [/INST]"
model1 = "rajj0/abstract_ai"
tokenizer = "NousResearch/llama-2-7b-chat-hf"
#model = PeftModel.from_pretrained(model1)
pipe = pipeline(task="text-generation", model=model1, tokenizer=tokenizer, max_length=100, temperature=0.7, top_p=0.92)
def summarize(text):
input = pipe(text)
return input
with gr.Blocks() as demo:
text = gr.Textbox(label="text", lines=10, placeholder="Enter text here")
output = gr.Textbox(label="Output")
btn = gr.Button("Abstract")
btn.click(fn=summarize, inputs=text, outputs=[output])
demo.launch()