fomafoma commited on
Commit
f14994f
·
verified ·
1 Parent(s): 189a9ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -2,7 +2,6 @@ import streamlit as st
2
  from transformers import pipeline
3
 
4
  # Load the language model pipeline
5
- # You can replace "gpt2" with another model or a locally fine-tuned model as desired
6
  @st.cache_resource
7
  def load_model():
8
  return pipeline("text-generation", model="gpt2")
@@ -12,6 +11,9 @@ llm = load_model()
12
  # Set up Streamlit columns for layout
13
  col1, col2 = st.columns(2)
14
 
 
 
 
15
  with col1:
16
  # User input box for text input
17
  user_input = st.text_input("Enter your text:", "")
@@ -53,4 +55,3 @@ with col2:
53
  if st.button("Copy Output"):
54
  # Display the output text in a way accessible to JS
55
  st.write(f'<button onclick="copyToClipboard(document.getElementById(\'output_text\').value)">Copy</button>', unsafe_allow_html=True)
56
-
 
2
  from transformers import pipeline
3
 
4
  # Load the language model pipeline
 
5
  @st.cache_resource
6
  def load_model():
7
  return pipeline("text-generation", model="gpt2")
 
11
  # Set up Streamlit columns for layout
12
  col1, col2 = st.columns(2)
13
 
14
+ # Initialize output_text with a default value
15
+ output_text = "No output yet. Please generate a response."
16
+
17
  with col1:
18
  # User input box for text input
19
  user_input = st.text_input("Enter your text:", "")
 
55
  if st.button("Copy Output"):
56
  # Display the output text in a way accessible to JS
57
  st.write(f'<button onclick="copyToClipboard(document.getElementById(\'output_text\').value)">Copy</button>', unsafe_allow_html=True)