awacke1 commited on
Commit
0ac4753
1 Parent(s): 6de3f2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -33,7 +33,7 @@ def AIMemory(name: str, message: str):
33
  writer = csv.DictWriter(csvfile, fieldnames=["name", "message", "time"])
34
  writer.writerow({"name": name, "message": message, "time": str(datetime.now())})
35
  commit_url = repo.push_to_hub()
36
- return {"name": name, "message": message, "time": str(datetime.now())}
37
 
38
  with open('Mindfulness.txt', 'r') as file:
39
  context = file.read()
@@ -43,20 +43,19 @@ repo = Repository(
43
  local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
44
  )
45
 
46
- #generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN)
47
- #generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B", api_key=HF_TOKEN)
48
- #generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN)
49
 
50
- SplitterInputBox = gr.inputs.Textbox(lines=5, label="Enter a sentence to get another sentence.")
51
  def calculator(text1, operation, text2):
52
  if operation == "add":
53
- return text1 + text2
54
  elif operation == "subtract":
55
- return text1 - text2
56
  elif operation == "multiply":
57
- return text1 * text2
58
  elif operation == "divide":
59
- return text1 / text2
60
 
61
  demo = gr.Interface(
62
  calculator,
 
33
  writer = csv.DictWriter(csvfile, fieldnames=["name", "message", "time"])
34
  writer.writerow({"name": name, "message": message, "time": str(datetime.now())})
35
  commit_url = repo.push_to_hub()
36
+ return ""
37
 
38
  with open('Mindfulness.txt', 'r') as file:
39
  context = file.read()
 
43
  local_dir="data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN
44
  )
45
 
46
+ generator1 = gr.Interface.load("huggingface/gpt2-large", api_key=HF_TOKEN)
47
+ generator2 = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B", api_key=HF_TOKEN)
48
+ generator3 = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", api_key=HF_TOKEN)
49
 
 
50
  def calculator(text1, operation, text2):
51
  if operation == "add":
52
+ return generator1(text1) + generator2(text2)
53
  elif operation == "subtract":
54
+ return replace(generator1(text1), generator2(text2), "")
55
  elif operation == "multiply":
56
+ return generator1(text1) + generator2(text2) + generator2(text3)
57
  elif operation == "divide":
58
+ return replace(generator1(text1), generator3(text2), "")
59
 
60
  demo = gr.Interface(
61
  calculator,