streamlit stuff
Browse files
app.py
CHANGED
|
@@ -2,6 +2,8 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
| 2 |
import transformers
|
| 3 |
import torch
|
| 4 |
|
|
|
|
|
|
|
| 5 |
model = "tiiuae/falcon-40b"
|
| 6 |
|
| 7 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
|
@@ -13,13 +15,20 @@ pipeline = transformers.pipeline(
|
|
| 13 |
trust_remote_code=True,
|
| 14 |
device_map="auto",
|
| 15 |
)
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import transformers
|
| 3 |
import torch
|
| 4 |
|
| 5 |
+
import streamlit as st
|
| 6 |
+
|
| 7 |
model = "tiiuae/falcon-40b"
|
| 8 |
|
| 9 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
|
|
|
| 15 |
trust_remote_code=True,
|
| 16 |
device_map="auto",
|
| 17 |
)
|
| 18 |
+
|
| 19 |
+
text = st.text_area("enter a prompt!")
|
| 20 |
+
|
| 21 |
+
if text:
|
| 22 |
+
out = pipeline(
|
| 23 |
+
text,
|
| 24 |
+
max_length=200,
|
| 25 |
+
do_sample=True,
|
| 26 |
+
top_k=10,
|
| 27 |
+
num_return_sequences=1,
|
| 28 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
st.json(out)
|
| 32 |
+
#for o in out:
|
| 33 |
+
#st.json(o)
|
| 34 |
+
#print(f"Result: {seq['generated_text']}")
|