SUSSYMANBI commited on
Commit
e644d85
·
1 Parent(s): b9ef2ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -1,7 +1,18 @@
1
- import streamlit as st
2
- st.title("7B demo")
3
- x = st.text("early demo version")
4
- x = st.slider("total correction")
5
- x = st.slider("accuracy ")
6
- x = st.button("start")
7
- x = st.text("note. this is stil in beta stage")
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Load the Hugging Face pipeline
5
+ nlp_pipeline = pipeline("text-generation", model="gpt2")
6
+
7
+ # Streamlit app title and description
8
+ st.title("Hugging Face Streamlit Demo")
9
+ st.write("This app demonstrates how to use Hugging Face's models with Streamlit.")
10
+
11
+ # User input for text generation
12
+ user_input = st.text_input("Enter some text:", "")
13
+
14
+ # Generate text using the Hugging Face model
15
+ if user_input:
16
+ generated_text = nlp_pipeline(user_input, max_length=50, num_return_sequences=1)
17
+ st.write("Generated Text:")
18
+ st.write(generated_text[0]['generated_text'])