interface textbox
Browse files
app.py
CHANGED
@@ -2,11 +2,11 @@ import gradio as gr
|
|
2 |
from transformers import pipeline, set_seed
|
3 |
from transformers import GPTNeoForCausalLM, GPT2Tokenizer
|
4 |
|
|
|
|
|
5 |
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")
|
6 |
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
|
7 |
|
8 |
-
set_seed(42)
|
9 |
-
|
10 |
|
11 |
def Bemenet(bemenet):
|
12 |
input_ids = tokenizer(bemenet, return_tensors="pt").input_ids
|
@@ -19,11 +19,12 @@ def Bemenet(bemenet):
|
|
19 |
)
|
20 |
return tokenizer.batch_decode(gen_tokens)[0]
|
21 |
|
|
|
22 |
|
23 |
interface = gr.Interface(fn=Bemenet,
|
24 |
-
title="
|
25 |
-
description="
|
26 |
-
inputs=
|
27 |
-
outputs=
|
28 |
|
29 |
interface.launch()
|
|
|
2 |
from transformers import pipeline, set_seed
|
3 |
from transformers import GPTNeoForCausalLM, GPT2Tokenizer
|
4 |
|
5 |
+
set_seed(42)
|
6 |
+
|
7 |
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")
|
8 |
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
|
9 |
|
|
|
|
|
10 |
|
11 |
def Bemenet(bemenet):
|
12 |
input_ids = tokenizer(bemenet, return_tensors="pt").input_ids
|
|
|
19 |
)
|
20 |
return tokenizer.batch_decode(gen_tokens)[0]
|
21 |
|
22 |
+
textbox = gr.Textbox()
|
23 |
|
24 |
interface = gr.Interface(fn=Bemenet,
|
25 |
+
title="GPT-3",
|
26 |
+
description="A GPT-3 egy előtanított nyelvi modell, ami nem párbeszédre lett optimalizálva. Használatakor figyelj erre, érdemesebb olyan bemenetekkel próbálkozni amik az eredeti tanítási célt használják ki.",
|
27 |
+
inputs=textbox,
|
28 |
+
outputs=textbox)
|
29 |
|
30 |
interface.launch()
|