Spaces:
Paused
Paused
File size: 653 Bytes
6f4648b d293ad6 6f4648b c77b659 4d4a93d d293ad6 c77b659 6f4648b d293ad6 6f4648b c77b659 d293ad6 6f4648b d293ad6 6f4648b d293ad6 |
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 |
import streamlit as st
from openai import OpenAI
st.title("Summarize text with OpenAI's API")
key = st.secrets["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)
|