Lazar Radojevic commited on
Commit
c212d1a
·
1 Parent(s): fd98490
Files changed (6) hide show
  1. .cache/.gitkeep +0 -0
  2. Dockerfile +1 -1
  3. README.md +0 -1
  4. app.py +0 -36
  5. poe/common-tasks.toml +0 -52
  6. run.py +1 -4
.cache/.gitkeep DELETED
File without changes
Dockerfile CHANGED
@@ -27,7 +27,7 @@ RUN pip install --no-cache-dir -r requirements.txt
27
  COPY --chown=user . .
28
 
29
  # Expose the port FastAPI will run on
30
- EXPOSE 7860 8000
31
 
32
  # Command to run the FastAPI application
33
  CMD ["python", "run.py"]
 
27
  COPY --chown=user . .
28
 
29
  # Expose the port FastAPI will run on
30
+ EXPOSE 7860
31
 
32
  # Command to run the FastAPI application
33
  CMD ["python", "run.py"]
README.md CHANGED
@@ -6,7 +6,6 @@ colorTo: green
6
  sdk: docker
7
  pinned: false
8
  license: apache-2.0
9
- app_file: app.py
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
6
  sdk: docker
7
  pinned: false
8
  license: apache-2.0
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py DELETED
@@ -1,36 +0,0 @@
1
- import streamlit as st
2
- import requests
3
- from typing import List, Tuple
4
-
5
- API_URL = "https://huggingface.co/spaces/lazarr19/prompt-engine/most_similar"
6
-
7
-
8
- def get_similar_prompts(query: str, n: int) -> List[Tuple[float, str]]:
9
- try:
10
- response = requests.post(API_URL, json={"query": query, "n": n})
11
- if response.status_code == 200:
12
- return response.json().get("similar_prompts", [])
13
- else:
14
- st.error(f"Error: {response.status_code} - {response.text}")
15
- return []
16
- except requests.exceptions.RequestException as e:
17
- st.error(f"Request error: {e}")
18
- return []
19
-
20
-
21
- st.title("Prompt Search Engine")
22
-
23
- query = st.text_input("Enter a prompt:")
24
- n = st.slider("Number of similar prompts to retrieve:", 1, 20, 5)
25
-
26
- if st.button("Search"):
27
- if query:
28
- response = get_similar_prompts(query, n)
29
- if response:
30
- st.write(f"Top {n} similar prompts:")
31
- for query_response in response:
32
- st.write(
33
- f"**Score:** {query_response['score']:.4f} | **Prompt:** {query_response['prompt']}"
34
- )
35
- else:
36
- st.warning("Please enter a prompt to search.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
poe/common-tasks.toml DELETED
@@ -1,52 +0,0 @@
1
- # This file defines common tasks that most python projects can benefit from
2
-
3
- [tool.poe.tasks.format-isort]
4
- help = "Format code with isort"
5
- cmd = "isort ."
6
-
7
- [tool.poe.tasks.format-black]
8
- help = "Format code with black"
9
- cmd = "black ."
10
-
11
- [tool.poe.tasks.format]
12
- help = "Run code formating tools"
13
- sequence = ["format-isort", "format-black"]
14
-
15
- [tool.poe.tasks.style-black]
16
- help = "Validate black code style"
17
- cmd = "black . --check --diff"
18
-
19
- [tool.poe.tasks.style-isort]
20
- help = "Validate isort code style"
21
- cmd = "isort . --check --diff"
22
-
23
- [tool.poe.tasks.style]
24
- help = "Validate code style"
25
- sequence = ["style-isort", "style-black"]
26
-
27
- [tool.poe.tasks.types]
28
- help = "Run the type checker"
29
- cmd = "mypy . --ignore-missing-imports --check-untyped-defs --install-types --non-interactive"
30
-
31
- [tool.poe.tasks.lint]
32
- help = "Evaluate ruff rules"
33
- cmd = "ruff check ."
34
-
35
- [tool.poe.tasks.test]
36
- help = "Run unit tests"
37
- cmd = "pytest -p no:cacheprovider"
38
-
39
- [tool.poe.tasks.clean]
40
- help = "Remove automatically generated files"
41
- cmd = """
42
- rm -rf dist
43
- .mypy_cache
44
- .pytest_cache
45
- .ruff_cache
46
- ./**/__pycache__/
47
- ./**/*.pyc
48
- """
49
-
50
- [tool.poe.tasks.check]
51
- help = "Run all checks on the code base"
52
- sequence = ["style", "types", "lint", "clean"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
run.py CHANGED
@@ -1,7 +1,4 @@
1
  import uvicorn
2
 
3
- # import subprocess
4
-
5
  if __name__ == "__main__":
6
- uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
7
- # subprocess.run(["streamlit", "run", "app.py", "--server.port", "7860"])
 
1
  import uvicorn
2
 
 
 
3
  if __name__ == "__main__":
4
+ uvicorn.run("main:app", host="0.0.0.0", port=7860, reload=True)