Spaces:
Paused
Paused
davidefiocco
commited on
Commit
•
4d5fcf9
1
Parent(s):
7e03458
Improve UI
Browse files
app.py
CHANGED
@@ -20,10 +20,10 @@ name, authentication_status, username = authenticator.login('Login', 'main')
|
|
20 |
|
21 |
st.title("Le risposte alle tue domande personali")
|
22 |
|
23 |
-
input = st.text_input("Scrivi una domanda in italiano e comparirà la risposta!")
|
24 |
-
|
25 |
if authentication_status:
|
26 |
|
|
|
|
|
27 |
if input:
|
28 |
|
29 |
response = get_answer(input)
|
|
|
20 |
|
21 |
st.title("Le risposte alle tue domande personali")
|
22 |
|
|
|
|
|
23 |
if authentication_status:
|
24 |
|
25 |
+
input = st.text_input("Scrivi una domanda in italiano e comparirà la risposta!")
|
26 |
+
|
27 |
if input:
|
28 |
|
29 |
response = get_answer(input)
|
utils.py
CHANGED
@@ -38,8 +38,6 @@ def get_answer(input):
|
|
38 |
|
39 |
openai.api_key = st.secrets("OPENAI_API_KEY")
|
40 |
|
41 |
-
print(prompt + input)
|
42 |
-
|
43 |
response = openai.Completion.create(
|
44 |
model="text-davinci-003",
|
45 |
prompt=prompt + input,
|
@@ -50,4 +48,8 @@ def get_answer(input):
|
|
50 |
presence_penalty=0.0,
|
51 |
)
|
52 |
|
53 |
-
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
openai.api_key = st.secrets("OPENAI_API_KEY")
|
40 |
|
|
|
|
|
41 |
response = openai.Completion.create(
|
42 |
model="text-davinci-003",
|
43 |
prompt=prompt + input,
|
|
|
48 |
presence_penalty=0.0,
|
49 |
)
|
50 |
|
51 |
+
ans = response["choices"][0]["text"].replace("Risposta:", "").strip()
|
52 |
+
|
53 |
+
print(f"{input} {ans}")
|
54 |
+
|
55 |
+
return ans
|