Spaces:
Runtime error
Runtime error
File size: 621 Bytes
413fb4a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
# %% auto 0
__all__ = ['MODEL_ID', 'pipe', 'iface', 'generate']
# %% app.ipynb 0
import gradio as gr
from transformers import pipeline
# %% app.ipynb 1
MODEL_ID = "facebook/galactica-125m"
pipe = pipeline("text-generation", model=MODEL_ID)
# %% app.ipynb 3
def generate(text):
return pipe(text, max_length=100)[0]["generated_text"]
# %% app.ipynb 4
iface = gr.Interface(
fn=generate,
inputs="text",
outputs="text",
examples=[["A force of 0.6N is applied to an object, which accelerates at 3m/s. What is its mass? <work>"]],
)
iface.launch()
|