Spaces:
Paused
Paused
Davide Fiocco
commited on
Commit
•
6f4648b
1
Parent(s):
d733688
Add basic functionality
Browse files- app.py +21 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import openai
|
3 |
+
|
4 |
+
key = st.text_input("Insert OpenAI API key")
|
5 |
+
prompt = st.text_area("Insert French text to summarize")
|
6 |
+
|
7 |
+
if (key and prompt):
|
8 |
+
openai.api_key = key
|
9 |
+
|
10 |
+
result = openai.Completion.create(
|
11 |
+
engine ="davinci",
|
12 |
+
prompt= f"{prompt} \n\n tl;dr ",
|
13 |
+
temperature=0.00,
|
14 |
+
max_tokens=20,
|
15 |
+
top_p=1.0,
|
16 |
+
frequency_penalty=0.0,
|
17 |
+
presence_penalty=0.0
|
18 |
+
)
|
19 |
+
|
20 |
+
st.write("Summary:")
|
21 |
+
st.write(result["choices"][0]["text"])
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
openai
|