Spaces:
Runtime error
Runtime error
File size: 1,186 Bytes
702d521 8c08288 883fdeb c7e880a 883fdeb c7e880a 9176e30 8c08288 9176e30 c7e880a 702d521 c53963d 9809c0c 702d521 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
'''
pip install streamlit openai langchain
import streamlit as st
from langchain.llms import OpenAI
st.title('π¦π Quickstart App')
openai_api_key = st.sidebar.text_input('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')
def generate_response(input_text):
llm = OpenAI(temperature=0.7, openai_api_key=openai_api_key)
st.info(llm(input_text))
with st.form('my_form'):
text = st.text_area('Enter text:', 'What are the three key pieces of advice for learning how to code?')
submitted = st.form_submit_button('Submit')
if not openai_api_key.startswith('sk-'):
st.warning('Please enter your OpenAI API key!', icon='β ')
if submitted and openai_api_key.startswith('sk-'):
generate_response(text)
'''
pip install streamlit wordcloud
import streamlit as st
from wordcloud import WordCloud
import matplotlib.pyplot as plt
# Create some sample text
text = 'Fun, fun, awesome, awesome, tubular, astounding, superb, great, amazing, amazing, amazing, amazing'
# Create and generate a word cloud image:
wordcloud = WordCloud().generate(text)
# Display the generated image:
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis("off")
plt.show()
st.pyplot() |