Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import openai
|
| 3 |
+
|
| 4 |
+
def generate_completion(user_prompt):
|
| 5 |
+
hidden_context = " "
|
| 6 |
+
prompt = hidden_context + user_prompt
|
| 7 |
+
response = openai.Completion.create(
|
| 8 |
+
model="davinci:ft-topwow-llc:esquiz-2023-09-25-22-27-57",
|
| 9 |
+
prompt=prompt,
|
| 10 |
+
max_tokens=30,
|
| 11 |
+
temperature=0,
|
| 12 |
+
stop=["_END"]
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
return response.choices[0].text.strip()
|
| 17 |
+
iface = gr.Interface(fn=generate_completion,
|
| 18 |
+
inputs=gr.inputs.Textbox(lines=5, placeholder='Write the phrase or words here'),
|
| 19 |
+
outputs='text',
|
| 20 |
+
title="schizophrenia",
|
| 21 |
+
description="Platform to detect potential schizophrenia symptoms, does not replace medical professionals. In the space you must write your discomfort or ailment and the respective ->, then you must click on send and the system will give you an answer on whether or not you have a potential symptom, or any recommendation. The axis of this artificial intelligence platform is based on transformer neural networks using the transfer learning technique and the fine tuning process.",
|
| 22 |
+
input_labels="phrases",
|
| 23 |
+
output_labels="forecast")
|
| 24 |
+
|
| 25 |
+
iface.launch()
|