Spaces:
Runtime error
Runtime error
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=[["The attention mechanism in LLM is"]] | |
) | |
iface.launch(share=True) |