awacke1 commited on
Commit
183aaf8
·
1 Parent(s): 756935c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -28,6 +28,7 @@ from gradio import inputs, outputs
28
  import huggingface_hub
29
  from huggingface_hub import Repository, hf_hub_download, upload_file
30
  from datetime import datetime
 
31
  # created new dataset as awacke1/MindfulStory.csv
32
  DATASET_REPO_URL = "https://huggingface.co/datasets/awacke1/MindfulStory.csv"
33
  DATASET_REPO_ID = "awacke1/MindfulStory.csv"
@@ -35,16 +36,6 @@ DATA_FILENAME = "MindfulStory.csv"
35
  DATA_FILE = os.path.join("data", DATA_FILENAME)
36
  HF_TOKEN = os.environ.get("HF_TOKEN")
37
 
38
- SCRIPT = """
39
- <script>
40
- if (!window.hasBeenRun) {
41
- window.hasBeenRun = true;
42
- console.log("should only happen once");
43
- document.querySelector("button.submit").click();
44
- }
45
- </script>
46
- """
47
-
48
  # Download dataset repo using hub download
49
  try:
50
  hf_hub_download(
@@ -74,8 +65,15 @@ def AIMemory(name: str, message: str):
74
  writer.writerow({"name": name, "message": message, "time": str(datetime.now())})
75
  commit_url = repo.push_to_hub()
76
  return {"name": name, "message": message, "time": str(datetime.now())}
 
 
 
 
77
 
78
- parallelModel = gr.Parallel(generator1, generator2, generator3, inputs = SplitterInputBox, examples=examples,
 
 
 
79
  title="Mindfulness Story Generation with Persistent Dataset Memory",
80
  description=f"Mindfulness Story Generation with Persistent Dataset Memory",
81
  article=f"Memory Dataset URL: [{DATASET_REPO_URL}]({DATASET_REPO_URL})" )
 
28
  import huggingface_hub
29
  from huggingface_hub import Repository, hf_hub_download, upload_file
30
  from datetime import datetime
31
+
32
  # created new dataset as awacke1/MindfulStory.csv
33
  DATASET_REPO_URL = "https://huggingface.co/datasets/awacke1/MindfulStory.csv"
34
  DATASET_REPO_ID = "awacke1/MindfulStory.csv"
 
36
  DATA_FILE = os.path.join("data", DATA_FILENAME)
37
  HF_TOKEN = os.environ.get("HF_TOKEN")
38
 
 
 
 
 
 
 
 
 
 
 
39
  # Download dataset repo using hub download
40
  try:
41
  hf_hub_download(
 
65
  writer.writerow({"name": name, "message": message, "time": str(datetime.now())})
66
  commit_url = repo.push_to_hub()
67
  return {"name": name, "message": message, "time": str(datetime.now())}
68
+
69
+
70
+ with open('Mindfulness.txt', 'r') as file:
71
+ context = file.read()
72
 
73
+ parallelModel = gr.Parallel(generator1, generator2, generator3,
74
+ #inputs = SplitterInputBox,
75
+ inputs=[gr.inputs.Textbox(lines=7, default=context, label="Context paragraph"), gr.inputs.Textbox(lines=3, default=question, label="Question")],
76
+ examples=examples,
77
  title="Mindfulness Story Generation with Persistent Dataset Memory",
78
  description=f"Mindfulness Story Generation with Persistent Dataset Memory",
79
  article=f"Memory Dataset URL: [{DATASET_REPO_URL}]({DATASET_REPO_URL})" )