Spaces:
Runtime error
Runtime error
# 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() | |