Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,23 +45,29 @@ generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN)
|
|
| 45 |
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B", api_key=HF_TOKEN)
|
| 46 |
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN)
|
| 47 |
|
| 48 |
-
def calculator(
|
| 49 |
-
if
|
| 50 |
-
output =
|
| 51 |
-
|
|
|
|
| 52 |
return output
|
| 53 |
-
elif
|
| 54 |
-
output =
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
return output
|
| 61 |
-
elif operation == "divide":
|
| 62 |
-
output = generator1(text2) + generator2(text1) + generator3(text2)
|
| 63 |
-
saved = AIMemory(text1 + " " + text2, output)
|
| 64 |
-
return output.replace(text1, "").replace(text2, "")
|
| 65 |
|
| 66 |
#with open('Mindfulness.txt', 'r') as file:
|
| 67 |
# context = file.read()
|
|
@@ -91,6 +97,7 @@ demo = gr.Interface(
|
|
| 91 |
],
|
| 92 |
"text",
|
| 93 |
examples=examples,
|
|
|
|
| 94 |
live=True,
|
| 95 |
)
|
| 96 |
demo.launch()
|
|
|
|
| 45 |
generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B", api_key=HF_TOKEN)
|
| 46 |
generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN)
|
| 47 |
|
| 48 |
+
def calculator(intro, operator, outro):
|
| 49 |
+
if operator == "add":
|
| 50 |
+
output = generator2(intro) + generator3(outro)
|
| 51 |
+
title = intro + " " + outro
|
| 52 |
+
saved = AIMemory(title, output)
|
| 53 |
return output
|
| 54 |
+
elif operator == "subtract":
|
| 55 |
+
output = generator2(outro) + generator3(intro)
|
| 56 |
+
title = outro + " " + intro
|
| 57 |
+
saved = AIMemory(title, output)
|
| 58 |
+
output = output.replace(intro, "").replace(outro, "")
|
| 59 |
+
return output
|
| 60 |
+
elif operator == "multiply":
|
| 61 |
+
output = generator1(intro) + generator2(outro) + generator3(intro)
|
| 62 |
+
title = intro + " " + outro + " " + intro
|
| 63 |
+
saved = AIMemory(title, output)
|
| 64 |
+
return output
|
| 65 |
+
elif operator == "divide":
|
| 66 |
+
output = generator1(outro) + generator2(intro) + generator3(outro)
|
| 67 |
+
title = outro + " " + intro + " " + outro
|
| 68 |
+
saved = AIMemory(title, output)
|
| 69 |
+
output = output.replace(intro, "").replace(outro, "")
|
| 70 |
return output
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
#with open('Mindfulness.txt', 'r') as file:
|
| 73 |
# context = file.read()
|
|
|
|
| 97 |
],
|
| 98 |
"text",
|
| 99 |
examples=examples,
|
| 100 |
+
article="Saved story memory is at URL: https://huggingface.co/datasets/awacke1/MindfulStory.csv",
|
| 101 |
live=True,
|
| 102 |
)
|
| 103 |
demo.launch()
|