galactica-base / app.py
morenolq's picture
Create app.py
3c0e5e4
raw history blame
No virus
697 Bytes
import gradio as gr
from transformers import pipeline
import galai as gal
model = gal.load_model("base", num_gpus = 0, dtype='float16')
def predict(text):
text = text.strip()
out_text = model.generate(text)
out_text = "<p>" + out_text + "</p>"
out_text = out_text.replace(text, text + "<b><span style='background-color: #ffffcc;'>")
out_text = out_text + "</span></b>"
out_text = out_text.replace("\n", "<br>")
return out_text
iface = gr.Interface(
fn=predict,
inputs=gr.Textbox(lines=10),
outputs=gr.HTML(),
description="Galactica",
examples=[["Abstractive Generation of Scientific Slides from Academic Articles"]]
)
iface.launch(share=True)