Spaces:
Runtime error
Runtime error
commit 800
Browse files- .gitattributes +0 -0
- README.md +0 -0
- app.py +18 -16
- requirements.txt +0 -0
.gitattributes
CHANGED
File without changes
|
README.md
CHANGED
File without changes
|
app.py
CHANGED
@@ -1,23 +1,25 @@
|
|
1 |
import openai
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
5 |
-
|
|
|
6 |
response = openai.Completion.create(
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
14 |
)
|
15 |
-
resumo=response["choices"][0].text
|
16 |
return resumo
|
17 |
|
18 |
-
demo = gr.Interface(fn=metadata_generator, inputs
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
background-image: url("https://drive.google.com/uc?export=view&id=1KNnISAUcvh2Pt08f-EJZJYCIgkrKw3PI"); repeat 0 0;}').launch(share=False)
|
|
|
1 |
import openai
|
2 |
import gradio as gr
|
3 |
|
4 |
+
|
5 |
+
def metadata_generator(api, text):
|
6 |
+
openai.api_key = api
|
7 |
response = openai.Completion.create(
|
8 |
+
engine="text-davinci-003",
|
9 |
+
prompt="{}\n\nPlease provide 6 semantically similar phrases for the phrase above mentioned".format(
|
10 |
+
text),
|
11 |
+
temperature=0.9,
|
12 |
+
max_tokens=800,
|
13 |
+
top_p=1.0,
|
14 |
+
frequency_penalty=0.0,
|
15 |
+
presence_penalty=0.0
|
16 |
)
|
17 |
+
resumo = response["choices"][0].text
|
18 |
return resumo
|
19 |
|
20 |
+
demo = gr.Interface(fn=metadata_generator, inputs=[gr.inputs.Textbox(label='ENTER OPEN AI API KEY'),
|
21 |
+
gr.inputs.Textbox(label='ENTER A PHRASE FOR SEMANTIC SIMILARITY - Click *Clear* before adding new input')],
|
22 |
+
outputs=gr.outputs.Textbox(
|
23 |
+
label='SEMANTIC SIMILAR PHRASES'),
|
24 |
+
css='div {margin-left: auto; margin-right: auto; width: 100%;\
|
25 |
+
background-image: url("https://drive.google.com/uc?export=view&id=1KNnISAUcvh2Pt08f-EJZJYCIgkrKw3PI"); repeat 0 0;}').launch(share=False)
|
requirements.txt
CHANGED
File without changes
|