mkoot007 commited on
Commit
bec6716
1 Parent(s): c3811c5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Create a T5 text2text-generation pipeline
5
+ pipe = pipeline("text2text-generation", model="kaist-ai/prometheus-13b-v1.0")
6
+
7
+ # Define the Streamlit app
8
+ st.title("Text Generation App")
9
+
10
+ # Ask the user for input text
11
+ user_input = st.text_area("Enter text:")
12
+
13
+ # Generate text when the user clicks the button
14
+ if st.button("Generate Text"):
15
+ if user_input:
16
+ # Use the specified pipeline to generate text
17
+ generated_text = pipe(user_input, max_length=100, do_sample=True)[0]["generated_text"]
18
+ st.write("Generated Text:")
19
+ st.write(generated_text)
20
+ else:
21
+ st.warning("Please enter text.")
22
+
23
+ # Customize the Streamlit app's appearance and other features as needed.