Spaces:
Build error
Build error
File size: 1,259 Bytes
8b592ae abdf1a8 8b592ae 6e1bbdd 8b592ae |
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 27 28 29 30 31 32 33 34 35 36 37 |
import gradio as gr
from transformers import pipeline
import os
theme = "darkgrass"
title = "GPT-NeoX(Korean) Demo"
model_name = "EleutherAI/gpt-neox-ko-1.3b"
description = "GPT-NeoX νκ΅μ΄ λͺ¨λΈμ μμ°νλ λ°λͺ¨νμ΄μ§ μ
λλ€."
# article = "<p style='text-align: center'><a href='https://github.com/kingoflolz/mesh-transformer-jax' target='_blank'>GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model</a></p>"
examples = [
["μΈκ°μ²λΌ μκ°νκ³ , νλνλ 'μ§λ₯'μ ν΅ν΄"],
["λνλ―Όκ΅μ 2040λ
μ λ§μ "],
["2040λ
λ―Έκ΅μ, "]
]
pipe = pipeline('text-generation', model=model_name, use_auth_token=os.environ['TOKEN'])
def predict(text):
return pipe(text, do_sample=True, return_full_text=False, max_length=100)[0]['generated_text']
iface = gr.Interface(
fn=predict,
inputs='text',
outputs='text',
examples=examples
)
iface.launch()
# print(generated) # print: μΈκ°μ²λΌ μκ°νκ³ , νλνλ 'μ§λ₯'μ ν΅ν΄ μΈλ₯κ° μ΄μ κΉμ§ νμ§ λͺ»νλ λ¬Έμ μ ν΄λ΅μ μ°Ύμ μ μμ κ²μ΄λ€. κ³ΌνκΈ°μ μ΄ κ³ λλ‘ λ°λ¬ν 21μΈκΈ°λ₯Ό μ΄μκ° μ°λ¦¬ μμ΄λ€μκ² κ°μ₯ νμν κ²μ μ¬κ³ λ ₯ νλ ¨μ΄λ€. μ¬κ³ λ ₯ νλ ¨μ ν΅ν΄, μΈμ
|