Spaces:
Runtime error
Runtime error
Yanxi Lin
commited on
Commit
·
e76ca61
1
Parent(s):
ee53e87
tryout: switch to another pipline
Browse files- .gitignore +1 -0
- README.md +3 -1
- app.py +5 -8
- requirements.txt +4 -3
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
env
|
README.md
CHANGED
@@ -8,5 +8,7 @@ sdk_version: 1.39.0
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
11 |
-
|
|
|
|
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
11 |
+
## how to locally run to debug
|
12 |
+
1. pip install requirements.txt
|
13 |
+
2. streamlit run app.py
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -11,19 +11,16 @@ tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
|
11 |
model = BartForConditionalGeneration.from_pretrained(model_name)
|
12 |
|
13 |
# Streamlit app structure
|
14 |
-
st.title("Text2Text Generation App")
|
15 |
-
st.write("Enter some
|
16 |
|
17 |
# Input text from the user
|
18 |
-
user_input = st.text_input("Input
|
19 |
|
20 |
# When the button is clicked, classify the input
|
21 |
if st.button("Generate"):
|
22 |
if user_input:
|
23 |
-
|
24 |
-
|
25 |
-
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
26 |
-
#result = pipe(user_input)
|
27 |
-
st.write(output_text)
|
28 |
else:
|
29 |
st.write("Please enter some text.")
|
|
|
11 |
model = BartForConditionalGeneration.from_pretrained(model_name)
|
12 |
|
13 |
# Streamlit app structure
|
14 |
+
st.title("Text2Text Generation App for Machine Learning Project")
|
15 |
+
st.write("Enter some cursing sentence (toxic sentence) and the model will generate the non-toxic one:")
|
16 |
|
17 |
# Input text from the user
|
18 |
+
user_input = st.text_input("Input sentence:")
|
19 |
|
20 |
# When the button is clicked, classify the input
|
21 |
if st.button("Generate"):
|
22 |
if user_input:
|
23 |
+
output = pipe(user_input)
|
24 |
+
st.write(output)
|
|
|
|
|
|
|
25 |
else:
|
26 |
st.write("Please enter some text.")
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
1 |
+
streamlit==1.39.0
|
2 |
+
transformers==4.40.1
|
3 |
+
transformers==4.45.2
|
4 |
+
torch
|