Youssouf Traore
commited on
Commit
·
52cbae5
1
Parent(s):
7758f36
Update app.py
Browse files
app.py
CHANGED
@@ -24,13 +24,28 @@ def infer(im):
|
|
24 |
"rect": poly["dimensions"]
|
25 |
})
|
26 |
|
27 |
-
return text
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
iface = gr.Interface(
|
31 |
fn=infer,
|
32 |
title="Mariam - Beta",
|
33 |
description=" La maj du siècle. ",
|
34 |
inputs=[gr.Image(type="pil")],
|
35 |
-
outputs=["
|
36 |
).launch()
|
|
|
24 |
"rect": poly["dimensions"]
|
25 |
})
|
26 |
|
|
|
27 |
|
28 |
+
def gpt(text):
|
29 |
+
if not text:
|
30 |
+
return "Veuillez saisir une question."
|
31 |
+
f_prompt = f""" reformule ça
|
32 |
+
{text}. """
|
33 |
+
|
34 |
+
response = openai.Completion.create(
|
35 |
+
model="text-davinci-003",
|
36 |
+
prompt=f_prompt,
|
37 |
+
temperature=0.9,
|
38 |
+
max_tokens=3500,
|
39 |
+
top_p=1)
|
40 |
+
|
41 |
+
answer = response.choices[0].text.strip()
|
42 |
+
print(answer)
|
43 |
+
return answer
|
44 |
|
45 |
iface = gr.Interface(
|
46 |
fn=infer,
|
47 |
title="Mariam - Beta",
|
48 |
description=" La maj du siècle. ",
|
49 |
inputs=[gr.Image(type="pil")],
|
50 |
+
outputs=["answer"],
|
51 |
).launch()
|