Simon Strandgaard commited on
Commit
0bca3d3
·
1 Parent(s): bf50f3c

Can I load code from the src module?

Browse files
Files changed (1) hide show
  1. app.py +25 -14
app.py CHANGED
@@ -1,20 +1,31 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import subprocess
4
-
5
- # Spawn a child process that lists files in the current directory.
6
- result = subprocess.run(["pwd"], capture_output=True, text=True)
7
- print("Child process output:")
8
- print(result.stdout)
9
-
10
- # Write a file
11
- with open("output.txt", "w") as f:
12
- f.write("Hello from Hugging Face 1 Spaces!")
13
-
14
- # Read the file back
15
- with open("output.txt", "r") as f:
16
- content = f.read()
17
- print("File content:", content)
 
 
 
 
 
 
 
 
 
 
 
18
 
19
 
20
  """
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  import subprocess
4
+ from src.prompt.prompt_catalog import PromptCatalog
5
+ import os
6
+
7
+ if True:
8
+ # Load modules from src
9
+ prompt_catalog = PromptCatalog()
10
+ prompt_catalog.load(os.path.join(os.path.dirname(__file__), 'src', 'plan', 'data', 'simple_plan_prompts.jsonl'))
11
+ prompt_item = prompt_catalog.find("4dc34d55-0d0d-4e9d-92f4-23765f49dd29")
12
+ print(prompt_item)
13
+
14
+ if False:
15
+ # Spawn a child process that lists files in the current directory.
16
+ result = subprocess.run(["pwd"], capture_output=True, text=True)
17
+ print("Child process output:")
18
+ print(result.stdout)
19
+
20
+ if False:
21
+ # Write a file
22
+ with open("output.txt", "w") as f:
23
+ f.write("Hello from Hugging Face 1 Spaces!")
24
+
25
+ # Read the file back
26
+ with open("output.txt", "r") as f:
27
+ content = f.read()
28
+ print("File content:", content)
29
 
30
 
31
  """