use an llm or something to make a text summarizer
To upload files, please first save the app
import streamlit as st
import openai
st.title('Text Summarizer')
input_text = st.text_area('Enter text to summarize:')
if st.button('Summarize'):
if input_text:
# OpenAI API call for summarization
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "user", "content": f'Summarize this text: {input_text}'}
]
)
summary = response.choices[0].message['content']
st.subheader('Summary:')
st.write(summary)
else:
st.warning('Please enter some text to summarize.')
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?