LegendaryToe commited on
Commit
ec6901a
·
1 Parent(s): 6668c8f
Files changed (2) hide show
  1. app.py +14 -5
  2. requirements.txt +3 -0
app.py CHANGED
@@ -1,8 +1,17 @@
1
  import streamlit as st
 
2
 
3
- # Title of the application
4
- st.title('Hello, World!')
5
 
6
- # A button that when clicked will show a message
7
- if st.button('Say hello'):
8
- st.write('Hello from Streamlit!')
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from transformers import pipeline
3
 
4
+ # Load your model; this example uses the GPT-2 model for text generation.
5
+ generator = pipeline('text-generation', model='gpt2')
6
 
7
+ st.title('Hugging Face Model Integration')
8
+
9
+ # Text input
10
+ user_input = st.text_input("Type a sentence to complete", "Streamlit is ")
11
+
12
+ # Generate text button
13
+ if st.button('Generate'):
14
+ # Generate text
15
+ result = generator(user_input, max_length=50, num_return_sequences=1)
16
+ # Display the generated text
17
+ st.text_area("Generated Text", result[0]['generated_text'], height=150)
requirements.txt CHANGED
@@ -1 +1,4 @@
1
  streamlit
 
 
 
 
1
  streamlit
2
+ transformers
3
+ torch
4
+