Spaces:
Sleeping
Sleeping
Commit
·
a06fbf0
1
Parent(s):
ec45107
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,9 @@ class Classifier:
|
|
10 |
# Specify the desired model and additional options
|
11 |
response = openai.Completion.create(
|
12 |
engine="text-davinci-003",
|
13 |
-
prompt=f"""Your are Mental healthcare Assistant. Classify the following text if the text related to Mental healtcare isse return 'True', Else not related return 'False':
|
14 |
-
Text to classify: {text}
|
|
|
15 |
temperature=0,
|
16 |
max_tokens=1, # We only need a single token as the classification result
|
17 |
n=1,
|
@@ -20,10 +21,11 @@ class Classifier:
|
|
20 |
|
21 |
# Extract and return the generated classification result
|
22 |
generated_text = response.choices[0].text.strip()
|
23 |
-
print(generated_text)
|
24 |
return generated_text
|
|
|
25 |
def clear_func(self):
|
26 |
return " "," "
|
|
|
27 |
def gradio_interface(self):
|
28 |
with gr.Blocks(css="style.css",theme=gr.themes.Soft()) as demo:
|
29 |
gr.HTML("""<center><h1>Mental healthcare</h1></center>""")
|
|
|
10 |
# Specify the desired model and additional options
|
11 |
response = openai.Completion.create(
|
12 |
engine="text-davinci-003",
|
13 |
+
prompt = f"""Your are Mental healthcare Assistant. Classify the following text if the text related to Mental healtcare isse return 'True', Else not related return 'False':
|
14 |
+
Text to classify: {text}
|
15 |
+
""" ,
|
16 |
temperature=0,
|
17 |
max_tokens=1, # We only need a single token as the classification result
|
18 |
n=1,
|
|
|
21 |
|
22 |
# Extract and return the generated classification result
|
23 |
generated_text = response.choices[0].text.strip()
|
|
|
24 |
return generated_text
|
25 |
+
|
26 |
def clear_func(self):
|
27 |
return " "," "
|
28 |
+
|
29 |
def gradio_interface(self):
|
30 |
with gr.Blocks(css="style.css",theme=gr.themes.Soft()) as demo:
|
31 |
gr.HTML("""<center><h1>Mental healthcare</h1></center>""")
|