changed code
Browse files
app.py
CHANGED
|
@@ -1,34 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
import transformers
|
| 3 |
import torch
|
| 4 |
|
| 5 |
import streamlit as st
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
-
pipeline = transformers.pipeline(
|
| 11 |
-
"text-generation",
|
| 12 |
-
model=model,
|
| 13 |
-
tokenizer=tokenizer,
|
| 14 |
-
torch_dtype=torch.bfloat16,
|
| 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 =
|
| 23 |
-
|
| 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']}")
|
|
|
|
| 1 |
+
import transformers import pipeline
|
|
|
|
| 2 |
import torch
|
| 3 |
|
| 4 |
import streamlit as st
|
| 5 |
|
| 6 |
+
pipe = pipeline('sentiment-analysis')
|
| 7 |
|
| 8 |
+
text = st.text_area('prompt here!')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
if text:
|
| 11 |
+
out = pipe(text)
|
| 12 |
+
st.json(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|