GPT3-summary / app.py
Davide Fiocco
Change secret name
0276ca2
raw
history blame contribute delete
660 Bytes
import streamlit as st
from openai import OpenAI
st.title("Summarize text with OpenAI's API")
key = st.secrets["OPENAI_API_KEY"]
client = OpenAI(api_key=key)
st.write("Summarize text by using OpenAI's API")
temperature = st.slider("Temperature:", min_value = 0.0, max_value = 0.3, step = 0.05)
prompt = st.text_area("Insert text to summarize:")
if (key and prompt):
result = client.completions.create(model="gpt-3.5-turbo-instruct",
prompt= f"{prompt} \n\n tl;dr ",
temperature=temperature,
max_tokens=200,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.0)
st.write("Summary:")
st.write(result.choices[0].text)