Spaces:
Sleeping
Sleeping
un-index
commited on
Commit
·
4c97ef8
1
Parent(s):
75197d8
- app.py +2 -2
- requirements.txt +4 -7
app.py
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 4 |
|
| 5 |
-
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
|
|
|
|
| 7 |
|
| 8 |
# prompt = "In a shocking finding, scientists discovered a herd of unicorns living in a remote, " \
|
| 9 |
# "previously unexplored valley, in the Andes Mountains. Even more surprising to the " \
|
|
@@ -15,7 +15,7 @@ def predict(text):
|
|
| 15 |
gen_tokens = model.generate(input_ids, do_sample=True, temperature=0.9, max_length=100)
|
| 16 |
gen_text = tokenizer.batch_decode(gen_tokens)[0]
|
| 17 |
return gen_text
|
| 18 |
-
|
| 19 |
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
| 20 |
iface.launch()
|
| 21 |
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 4 |
|
|
|
|
| 5 |
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
|
| 6 |
+
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
|
| 7 |
|
| 8 |
# prompt = "In a shocking finding, scientists discovered a herd of unicorns living in a remote, " \
|
| 9 |
# "previously unexplored valley, in the Andes Mountains. Even more surprising to the " \
|
|
|
|
| 15 |
gen_tokens = model.generate(input_ids, do_sample=True, temperature=0.9, max_length=100)
|
| 16 |
gen_text = tokenizer.batch_decode(gen_tokens)[0]
|
| 17 |
return gen_text
|
| 18 |
+
|
| 19 |
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
| 20 |
iface.launch()
|
| 21 |
|
requirements.txt
CHANGED
|
@@ -1,7 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
flax==0.3.6
|
| 6 |
-
torch==1.10.1
|
| 7 |
-
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
flax
|
| 3 |
+
torch
|
| 4 |
+
tensorflow
|
|
|
|
|
|
|
|
|